OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ipa/] [devirt-3.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* Verify that simple virtual calls on an object refrence are
2
   converted to simple calls by ipa-cp.  */
3
/* { dg-do run } */
4
/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized"  } */
5
 
6
extern "C" void abort (void);
7
 
8
class A
9
{
10
public:
11
  int data;
12
  virtual float distraction (float f);
13
  virtual int foo (int i);
14
};
15
 
16
class B : public A
17
{
18
public:
19
  virtual int foo (int i);
20
};
21
 
22
class C : public A
23
{
24
public:
25
  virtual int foo (int i);
26
};
27
 
28
float A::distraction (float f)
29
{
30
  f += 6.2;
31
  return f/2;
32
}
33
 
34
int A::foo (int i)
35
{
36
  return i + 1;
37
}
38
 
39
int B::foo (int i)
40
{
41
  return i + 2;
42
}
43
 
44
int C::foo (int i)
45
{
46
  return i + 3;
47
}
48
 
49
static int middleman (class A &obj, int i)
50
{
51
  return obj.foo (i);
52
}
53
 
54
int __attribute__ ((noinline,noclone)) get_input(void)
55
{
56
  return 1;
57
}
58
 
59
int main (int argc, char *argv[])
60
{
61
  class B b;
62
  if (middleman (b, get_input ()) != 3)
63
    abort ();
64
  return 0;
65
}
66
 
67
/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*B::foo"  "cp"  } } */
68
/* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 0 "optimized"} } */
69
/* { dg-final { cleanup-ipa-dump "cp" } } */
70
/* { dg-final { cleanup-tree-dump "optimized" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.