Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/phi-opt-34.c

raw
1 /* { dg-do compile } */
2 /* Disable early phiopt1 as early ccp1 does not export non-zero bits
3 so at the point of phiopt1, we don't know that a is [0,1] range */
4 /* { dg-options "-O1 -fdisable-tree-phiopt1 -fdump-tree-phiopt2-folding" } */
5
6 unsigned f(unsigned a)
7 {
8 a &= 1;
9 if (a > 0)
10 return a;
11 return 1;
12 }
13 /* PHIOPT2 should be able to change this into just return 1;
14 (which was `MAX<a, 1>` or `a | 1` but since a is known to be a
15 range of [0,1], it should be folded into 1)
16 And not fold it into `(a == 0) | a`. */
17 /* { dg-final { scan-tree-dump-not " == " "phiopt2" } } */
18 /* { dg-final { scan-tree-dump-not " if " "phiopt2" } } */
19 /* { dg-final { scan-tree-dump-not "Folded into the sequence:" "phiopt2" } } */
20 /* { dg-final { scan-tree-dump "return 1;" "phiopt2" } } */
21 /* We want to make sure that phiopt2 is happening and not some other pass
22 before it does the transformation. */
23 /* { dg-final { scan-tree-dump "Removing basic block" "phiopt2" } } */