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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ipa/] [devirt-2.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 using this pointer are converted
2
   to direct calls by ipa-cp.  */
3
/* { dg-do run } */
4
/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp"  } */
5
 
6
extern "C" void abort (void);
7
 
8
class A
9
{
10
public:
11
  int data;
12
  virtual int foo (int i);
13
  int middleman (int i)
14
  {
15
    return foo (i);
16
  }
17
};
18
 
19
class B : public A
20
{
21
public:
22
  virtual int foo (int i);
23
};
24
 
25
class C : public A
26
{
27
public:
28
  virtual int foo (int i);
29
};
30
 
31
int A::foo (int i)
32
{
33
  return i + 1;
34
}
35
 
36
int B::foo (int i)
37
{
38
  return i + 2;
39
}
40
 
41
int C::foo (int i)
42
{
43
  return i + 3;
44
}
45
 
46
int __attribute__ ((noinline,noclone)) get_input(void)
47
{
48
  return 1;
49
}
50
 
51
int main (int argc, char *argv[])
52
{
53
  class B b;
54
  int i;
55
  for (i = 0; i < get_input(); i++)
56
    if (b.middleman (get_input ()) != 3)
57
      abort ();
58
  return 0;
59
}
60
 
61
/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*B::foo"  "cp"  } } */
62
/* { dg-final { cleanup-ipa-dump "cp" } } */

powered by: WebSVN 2.1.0

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