Handle POINTER_TYPE_P in EVRP
gcc/ChangeLog:
2016-10-06 Kugan Vivekanandarajah <kuganv@linaro.org>
* tree-vrp.c (evrp_dom_walker::before_dom_children): Handle
POINTER_TYPE_P.
gcc/testsuite/ChangeLog:
2016-10-06 Kugan Vivekanandarajah <kuganv@linaro.org>
* gcc.dg/tree-ssa/evrp4.c: New test.
From-SVN: r240841
+2016-10-06 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ * tree-vrp.c (evrp_dom_walker::before_dom_children): Handle
+ POINTER_TYPE_P.
+
2016-10-05 Jeff Law <law@redhat.com>
PR tree-optimization/71661
+2016-10-06 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ * gcc.dg/tree-ssa/evrp4.c: New test.
+
2016-10-06 Jeff Law <law@redhat.com>
PR tree-optimization/71661
--- /dev/null
+/* { 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" } } */
&& 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. */