From: Kugan Vivekanandarajah Date: Thu, 6 Oct 2016 19:55:14 +0000 (+0000) Subject: Handle POINTER_TYPE_P in EVRP X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=65b25c9b437d4e8135f9b8fc66827c87a93cf71b;p=gcc.git Handle POINTER_TYPE_P in EVRP Handle POINTER_TYPE_P in EVRP gcc/ChangeLog: 2016-10-06 Kugan Vivekanandarajah * tree-vrp.c (evrp_dom_walker::before_dom_children): Handle POINTER_TYPE_P. gcc/testsuite/ChangeLog: 2016-10-06 Kugan Vivekanandarajah * gcc.dg/tree-ssa/evrp4.c: New test. From-SVN: r240841 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0092be861e8..b4ce1a73031 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-10-06 Kugan Vivekanandarajah + + * tree-vrp.c (evrp_dom_walker::before_dom_children): Handle + POINTER_TYPE_P. + 2016-10-05 Jeff Law PR tree-optimization/71661 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 56f1c8dbd40..e41e168efad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-10-06 Kugan Vivekanandarajah + + * gcc.dg/tree-ssa/evrp4.c: New test. + 2016-10-06 Jeff Law PR tree-optimization/71661 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/evrp4.c b/gcc/testsuite/gcc.dg/tree-ssa/evrp4.c new file mode 100644 index 00000000000..ebb87ed38b0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/evrp4.c @@ -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" } } */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 7a08be7b2aa..46bbd823bfc 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -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. */