aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/partition1_0.C
blob: 108803997d4912a44a7a930221f7b0733691c887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* { dg-require-effective-target freorder } */
/* { dg-options "-O2 -freorder-blocks-and-partition" } */
/* { dg-skip-if "PR target/47683" { mips-sgi-irix* } } */

struct A { A () __attribute__((noinline)); ~A () __attribute__((noinline)); };
A::A () { asm volatile ("" : : : "memory"); }
A::~A () { asm volatile ("" : : : "memory"); }

int bar () __attribute__((noinline));
void foo () __attribute__((noinline));

volatile int k, l;

int bar (int i)
{
  void *p = __builtin_alloca (i);
  asm volatile ("" : : "r" (i), "r" (p) : "memory");
  if (k) throw 6;
  return ++l;
}

void foo ()
{
  A a;
  try {
    A b;
    int i = bar (5);
    try { throw 6; } catch (int) {}
    if (__builtin_expect (i < 4500, 0)) {
      bar (7);
      try { bar (8); } catch (long) {}
      bar (10);
      if (__builtin_expect (i < 0, 0)) {
	try { bar (12); } catch (...) {}
	bar (16);
	bar (122);
      } else {
	try { bar (bar (7)); } catch (int) {}
      }
    } else {
      try { bar (bar (bar (9))); } catch (...) {}
      bar (5);
    }
  } catch (...) {
  }
}

int
main ()
{
  int i;
  for (i = 0; i < 10000; i++)
    foo ();
}