This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/35545] New: virtual call specialization not happening with FDO
- From: "xinliangli at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Mar 2008 05:55:26 -0000
- Subject: [Bug middle-end/35545] New: virtual call specialization not happening with FDO
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In the following example, virtual calls via ap should be speciallized -- there
is one dominatating call target, but compiling the program at -O3 with
-fprofile-use, it does not happen.
g++ -O1 -fprofile-generate devirt.cc
./a.out
g++ -fprofile-use -O3 -fdump-tree-optimized devirt.cc
// devirt.cc
class A {
public:
virtual int foo() {
return 1;
}
int i;
};
class B : public A
{
public:
virtual int foo() {
return 2;
}
int b;
} ;
int main()
{
int i;
A* ap = 0;
for (i = 0; i < 10000; i++)
{
if (i%7==0)
{
ap = new A();
}
else
ap = new B();
ap->foo();
delete ap;
}
return 0;
}
--
Summary: virtual call specialization not happening with FDO
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: xinliangli at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35545