Debian Codegraph @

gcc/testsuite/g++.dg/tree-prof/partition1.C

raw
1 /* Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'. */
2 /* { dg-require-effective-target freorder } */
3 /* { dg-options "-O2 -freorder-blocks-and-partition" } */
4
5 struct A { A () __attribute__((noinline)); ~A () __attribute__((noinline)); };
6 A::A () { asm volatile ("" : : : "memory"); }
7 A::~A () { asm volatile ("" : : : "memory"); }
8
9 int bar () __attribute__((noinline));
10 void foo () __attribute__((noinline));
11
12 volatile int k, l;
13
14 int bar (int i)
15 {
16 void *p = __builtin_alloca (i);
17 asm volatile ("" : : "r" (i), "r" (p) : "memory");
18 if (k) throw 6;
19 return ++l;
20 }
21
22 void foo ()
23 {
24 A a;
25 try {
26 A b;
27 int i = bar (5);
28 try { throw 6; } catch (int) {}
29 if (__builtin_expect (i < 4500, 0)) {
30 bar (7);
31 try { bar (8); } catch (long) {}
32 bar (10);
33 if (__builtin_expect (i < 0, 0)) {
34 try { bar (12); } catch (...) {}
35 bar (16);
36 bar (122);
37 } else {
38 try { bar (bar (7)); } catch (int) {}
39 }
40 } else {
41 try { bar (bar (bar (9))); } catch (...) {}
42 bar (5);
43 }
44 } catch (...) {
45 }
46 }
47
48 int
49 main ()
50 {
51 int i;
52 for (i = 0; i < 10000; i++)
53 foo ();
54 }