diff options
author | Richard Biener <rguenther@suse.de> | 2016-07-21 13:00:32 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-07-21 13:00:32 +0000 |
commit | 959cef7434c0383f32ff28ab012fe17d9d94a7c2 (patch) | |
tree | bd331a8d98f64c523d13a05c0eb435ce17dea62a /gcc | |
parent | 88617fe425b0f01305ede58de484592c11422f22 (diff) | |
download | gcc-959cef7434c0383f32ff28ab012fe17d9d94a7c2.zip gcc-959cef7434c0383f32ff28ab012fe17d9d94a7c2.tar.gz gcc-959cef7434c0383f32ff28ab012fe17d9d94a7c2.tar.bz2 |
re PR tree-optimization/71947 (x ^ y not folded to 0 if x == y by DOM)
2016-07-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/71947
* tree-vrp.c (extract_range_from_assert): Singleton symbolic
ranges have useful limit_vr information.
* gcc.dg/tree-ssa/vrp102.c: New testcase.
From-SVN: r238591
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/vrp102.c | 18 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 11 |
4 files changed, 36 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c79b12..39b3690 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2016-07-21 Richard Biener <rguenther@suse.de> + PR tree-optimization/71947 + * tree-vrp.c (extract_range_from_assert): Singleton symbolic + ranges have useful limit_vr information. + +2016-07-21 Richard Biener <rguenther@suse.de> + * function-tests.c (build_trivial_generic_function): Set BLOCK_SUPERCONTEXT of DECL_INITIAL. * omp-low.c (create_omp_child_function): Likewise. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 61b6fa9..cb2f9e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-21 Richard Biener <rguenther@suse.de> + + PR tree-optimization/71947 + * gcc.dg/tree-ssa/vrp102.c: New testcase. + 2016-07-21 Bin Cheng <bin.cheng@arm.com> * gcc.dg/tree-ssa/scev-15.c: New. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp102.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp102.c new file mode 100644 index 0000000..fb62e57 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp102.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1" } */ + +int f(int x, int y) +{ + int ret; + if (x == y) + ret = x ^ y; + else + ret = 1; + + return ret; +} + +/* We should have computed x ^ y as zero and propagated the result into the + PHI feeding the result. */ + +/* { dg-final { scan-tree-dump "ret_\[0-9\]+ = PHI <\[01\]\\\(\[0-9\]+\\\), \[01\]\\\(\[0-9\]+\\\)>" "vrp1" } } */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index b9ccb73..06364b7 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -1513,10 +1513,13 @@ extract_range_from_assert (value_range *vr_p, tree expr) limit_vr = (TREE_CODE (limit) == SSA_NAME) ? get_value_range (limit) : NULL; /* LIMIT's range is only interesting if it has any useful information. */ - if (limit_vr - && (limit_vr->type == VR_UNDEFINED - || limit_vr->type == VR_VARYING - || symbolic_range_p (limit_vr))) + if (! limit_vr + || limit_vr->type == VR_UNDEFINED + || limit_vr->type == VR_VARYING + || (symbolic_range_p (limit_vr) + && ! (limit_vr->type == VR_RANGE + && (limit_vr->min == limit_vr->max + || operand_equal_p (limit_vr->min, limit_vr->max, 0))))) limit_vr = NULL; /* Initially, the new range has the same set of equivalences of |