On March 14, 2016 7:25:31 PM GMT+01:00, Bernhard Reutner-Fischer <rep.dot....@gmail.com> wrote: >On March 14, 2016 12:58:20 PM GMT+01:00, Richard Biener ><rguent...@suse.de> wrote: >> >>I am testing the following patch to fix the regression in min/max >>detection introduced by comparison canonicalization like a < 267 >>to a <= 266. The patch allows us to identify all four min/max >>cases in the testcase below. >> >>Bootstrap and regtest running on x86_64-unknown-linux-gnu. > >>InLikew/testsuite/gcc.dg/tree-ssa/phi-opt-14.c >>=================================================================== >>*** gcc/testsuite/gcc.dg/tree-ssa/phi-opt-14.c (revision 0) >>--- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-14.c (working copy) >>*************** >>*** 0 **** >>--- 1,37 ---- >>+ /* { dg-do compile } */ >>+ /* { dg-options "-O -fdump-tree-phiopt1" } */ >>+ >>+ int test_01 (int a) >>+ { >>+ if (127 <= a) > >Shouldn't this be >= ?
No, note how the constant is left of the <=. Richard. >>+ a = 127; >>+ else if (a <= -128) >>+ a = -128; >>+ return a; >>+ } >>+ int test_02 (int a) >>+ { >>+ if (127 < a) > >and this > > >>+ a = 127; >>+ else if (a <= -128) >>+ a = -128; >>+ return a; >>+ } >>+ int test_03 (int a) >>+ { >>+ if (127 <= a) > >and this >= > >>+ a = 127; >>+ else if (a < -128) >>+ a = -128; >>+ return a; >>+ } >>+ int test_04 (int a) >>+ { >>+ if (127 < a) > >and > > >TIA, >>+ a = 127; >>+ else if (a < -128) >>+ a = -128; >>+ return a; >>+ } >>+ >>+ /* { dg-final { scan-tree-dump-not "if" "phiopt1" } } */