Debian Codegraph @

gcc/testsuite/g++.dg/tree-ssa/pr107876.C

raw
1 // { dg-do compile }
2 // { dg-require-effective-target c++11 }
3 // { dg-options "-O2 -funswitch-loops --param max-unswitch-insns=5 --param case-values-threshold=4 -fdump-tree-unswitch-details" }
4
5 class X {
6 public:
7 X();
8 X(const X&);
9 X(const volatile X &);
10 ~X();
11 };
12
13 X test17(int i) {
14 if (false) {
15 impossible:
16 if (i == 3)
17 return X();
18 }
19
20 while (true) {
21 X x;
22 if (i == 0)
23 return x;
24 if (i == 1)
25 break;
26 if (i == 2)
27 continue;
28 if (i == 3)
29 goto impossible;
30 if (i == 4)
31 __builtin_exit(1);
32 if (i == 5)
33 return x;
34 }
35 return X();
36 }
37
38 // { dg-final { scan-tree-dump "unswitching loop 1 on .switch. with condition: i_\[0-9\]+\\(D\\) == 2" "unswitch" } }