summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tree-prof/indir-call-prof.C
blob: 80b41865c0c4ac456d833a0dcc271ff843554d49 (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
/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */

struct A {
  A () {}

  virtual int AA (void)
  { return 0; }

};

struct B : public A {
  B () {}

  virtual int AA (void)
  { return 1; }
};

void * __attribute__((noinline,noclone)) wrap (void *p) { return p; }
int
main (void)
{
  A a;
  B b;
  
  A* p;

  p = (A *)wrap ((void *)&a);
  p->AA ();

  p = (B *)wrap ((void *)&b);
  p->AA ();
  
  return 0;
}

/* { dg-final-use { scan-ipa-dump "Indirect call -> direct call.* AA transformation on insn" "tree_profile_ipa" } } */
/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized" } } */
/* { dg-final-use { cleanup-tree-dump "optimized" } } */
/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */