From c9badd0cee1433af67ba5e1a45a90b4b659a244f Mon Sep 17 00:00:00 2001
From: Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org>
Date: Mon, 3 Oct 2016 06:12:05 +1100
Subject: [PATCH 1/5] Handle pointer type in evrp
---
gcc/testsuite/gcc.dg/tree-ssa/evrp4.c | 20 ++++++++++++++++++++
gcc/tree-vrp.c | 3 ++-
2 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/evrp4.c
new file mode 100644
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+int foo (int *p);
+
+struct st
+{
+ int a;
+ int b;
+};
+
+int bar (struct st *s)
+{
+
+ if (!s)
+ return 0;
+ foo (&s->a);
+}
+
+/* { dg-final { scan-tree-dump "\~\\\[0B, 0B\\\]" "evrp" } } */
@@ -10666,7 +10666,8 @@ evrp_dom_walker::before_dom_children (basic_block bb)
&& gimple_code (stmt) == GIMPLE_COND
&& (op0 = gimple_cond_lhs (stmt))
&& TREE_CODE (op0) == SSA_NAME
- && INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (stmt))))
+ && (INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (stmt)))
+ || POINTER_TYPE_P (TREE_TYPE (gimple_cond_lhs (stmt)))))
{
/* Entering a new scope. Try to see if we can find a VR
here. */
--
2.7.4