On Tue, 27 May 2014, Richard Biener wrote: > On Tue, 27 May 2014, Steven Bosscher wrote: > > > On Tue, May 27, 2014 at 12:27 PM, Richard Biener wrote: > > > * tree-vrp.c > > > (vrp_evaluate_conditional_warnv_with_ops_using_ranges): > > > Try using literal operands when comparing value-ranges failed. > > > > No test case? > > Sorry ;) Happens to patches I uncover in my dev tree. I'll try > to come up with sth (I remember coding it when workin on some > PR ... but I've lost track of which one).
Here is one (yeah, a bit artificial ...). Committed. Richard. 2014-05-27 Richard Biener <rguent...@suse.de> * gcc.dg/tree-ssa/vrp92.c: New testcase. Index: gcc/testsuite/gcc.dg/tree-ssa/vrp92.c =================================================================== --- gcc/testsuite/gcc.dg/tree-ssa/vrp92.c (revision 0) +++ gcc/testsuite/gcc.dg/tree-ssa/vrp92.c (working copy) @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ + +void bar (void); +int foo (int i, int j) +{ + int res = 1; + if (i < j) + { + /* We should be able to simplify the following conditional + during propagation. */ + if (i > j) + res = 0; + } + /* And compute res as having a value-range of [1,1]. */ + if (res) + return i; + return j; +} + +/* { dg-final { scan-tree-dump "res_.: \\\[1, 1\\\]" "vrp1" } } */ +/* { dg-final { scan-tree-dump-not "Threaded" "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */