Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/cmpbit-7.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-forwprop1" } */
3 /* PR tree-optimization/106164 */
4 /* PR tree-optimization/111456 */
5
6 _Bool f(int a)
7 {
8 _Bool t = a == 3;
9 unsigned t1 = a;
10 _Bool t2 = t1 >= 3;
11 return t | t2;
12 }
13
14 /* Should be able to optimize down to just `a > 2` during forwprop1 */
15 /* { dg-final { scan-tree-dump-not "a_\[0-9\]+.D. == 3" "forwprop1" } } */
16
17 _Bool f1(int b)
18 {
19 _Bool t = b == 3;
20 short t1 = b;
21 _Bool t2 = t1 >= 3;
22 return t | t2;
23 }
24
25 /* Should be able to optimize down to just `a > 2` during forwprop1 as `((short)a) >= 3` is
26 true already when `a == 3`. */
27 /* { dg-final { scan-tree-dump-not "b_\[0-9\]+.D. == 3" "forwprop1" } } */
28 /* { dg-final { scan-tree-dump-times "_\[0-9\]+ > 2" 2 "forwprop1" } } */