Remove outermost loop parameter.
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-dom-thread-2.c
blob6aaea8ecb38c9646f6f689d437ca682d1b18dbd7
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-vrp1-stats -fdump-tree-dom1-stats" } */
4 void foo();
5 void bla();
6 void bar();
8 /* In the following two cases, we should be able to thread edge through
9 the loop header. */
11 void thread_entry_through_header (void)
13 int i;
15 for (i = 0; i < 170; i++)
16 bla ();
19 void thread_latch_through_header (void)
21 int i = 0;
22 int first = 1;
26 if (first)
27 foo ();
29 first = 0;
30 bla ();
31 } while (i++ < 100);
34 /* This is a TODO -- it is correct to thread both entry and latch edge through
35 the header, but we do not handle this case yet. */
37 void dont_thread_1 (void)
39 int i = 0;
40 int first = 1;
44 if (first)
45 foo ();
46 else
47 bar ();
49 first = 0;
50 bla ();
51 } while (i++ < 100);
54 /* Avoid threading in the following two cases, to prevent creating subloops. */
56 void dont_thread_2 (int first)
58 int i = 0;
62 if (first)
63 foo ();
64 else
65 bar ();
67 first = 0;
68 bla ();
69 } while (i++ < 100);
72 void dont_thread_3 (int nfirst)
74 int i = 0;
75 int first = 0;
79 if (first)
80 foo ();
81 else
82 bar ();
84 first = nfirst;
85 bla ();
86 } while (i++ < 100);
89 /* Avoid threading in this case, in order to avoid creating loop with
90 multiple entries. */
92 void dont_thread_4 (int a, int nfirst)
94 int i = 0;
95 int first;
97 if (a)
98 first = 0;
99 else
100 first = 1;
104 if (first)
105 foo ();
106 else
107 bar ();
109 first = nfirst;
110 bla ();
111 } while (i++ < 100);
114 /* { dg-final { scan-tree-dump-times "Jumps threaded: 1" 1 "vrp1"} } */
115 /* { dg-final { scan-tree-dump-times "Jumps threaded: 2" 0 "vrp1"} } */
116 /* { dg-final { scan-tree-dump-times "Jumps threaded: 1" 0 "dom1"} } */
117 /* { dg-final { scan-tree-dump-times "Jumps threaded: 2" 1 "dom1"} } */
118 /* { dg-final { cleanup-tree-dump "dom1" } } */
119 /* { dg-final { cleanup-tree-dump "vrp1" } } */