Pass name cleanups
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-25.c
blobc2fb74e58715d964d364131652161ec584623f8d
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fdump-tree-profile_estimate" } */
4 int foo(void);
5 void bla(void);
6 void bar(void);
8 void test1 (void)
10 unsigned i;
12 /* Only one loop should be found here. */
13 i = 0;
14 while (1)
16 i++;
17 if (i == 100)
18 break;
20 if (foo ())
21 bla ();
22 else
23 bar ();
27 void test2 (void)
29 unsigned i, j;
31 /* Two loops should be found, in this case. */
32 i = j = 0;
33 while (1)
35 j++;
36 foo ();
37 if (j < 100)
38 continue;
40 i++;
41 j = 0;
42 if (i == 100)
43 break;
47 void test3 (void)
49 unsigned i, j, k;
51 /* Three loops. */
52 i = j = k = 0;
53 while (1)
55 j++;
56 foo ();
57 if (j < 100)
58 continue;
60 j = 0;
61 k++;
62 if (k < 100)
63 continue;
65 k = 0;
66 i++;
67 if (i == 100)
68 break;
72 void test4 (void)
74 unsigned i, j, k;
76 /* Two loops with a nested subloop. */
77 i = j = 0;
78 while (1)
80 j++;
81 foo ();
82 for (k = 0; k < 100; k++)
83 foo ();
85 if (j < 100)
86 continue;
88 i++;
89 j = 0;
90 if (i == 100)
91 break;
96 void test5 (void)
98 unsigned i, j;
100 /* Both subloop and non-subloop back edges. */
101 i = j = 0;
102 while (1)
104 j++;
105 foo ();
106 if (j < 100)
107 continue;
108 j = 0;
110 i++;
111 if (i == 100)
112 break;
114 if (foo ())
115 bla ();
116 else
117 bar ();
121 /* { dg-final { scan-tree-dump-times "Disambiguating loop" 5 "profile_estimate" } } */
122 /* For the following xfail marks, see PR35629. */
123 /* { dg-final { scan-tree-dump-times "Found latch edge" 5 "profile_estimate" { xfail *-*-* } } } */
124 /* { dg-final { scan-tree-dump-times "Merged latch edges" 2 "profile_estimate" { xfail *-*-* } } } */
125 /* { dg-final { scan-tree-dump-times "4 loops found" 2 "profile_estimate" { xfail *-*-* } } } */
126 /* { dg-final { scan-tree-dump-times "3 loops found" 2 "profile_estimate" { xfail *-*-* } } } */
127 /* { dg-final { scan-tree-dump-times "2 loops found" 1 "profile_estimate" { xfail *-*-* } } } */
129 /* { dg-final { cleanup-tree-dump "profile_estimate" } } */