Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-backedge.c

raw
1 // { dg-do compile }
2 // { dg-options "-O2 -fdisable-tree-ethread -fdisable-tree-thread1 -fdisable-tree-thread2 -fno-tree-dominator-opts -fdump-tree-threadfull2-details" }
3
4 // Test that we can thread jumps across the backedge of a loop through
5 // the switch statement to a particular case.
6 //
7 // Just in case, we disable all the jump threaders before loop
8 // optimizations to make sure we get a clean stab at this.
9
10 int foo (unsigned int x, int s)
11 {
12 while (s != 999)
13 {
14 switch (s)
15 {
16 case 0:
17 if (x)
18 s = 1;
19 break;
20 case 1:
21 if (x)
22 s = 999;
23 break;
24 default:
25 break;
26 }
27 x++;
28 }
29 return s;
30 }
31
32 // { dg-final { scan-tree-dump "Registering jump thread:.*normal \\(back\\)" "threadfull2" } }