[LLVMbugs] [Bug 8294] New: Obvious inline missed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 4 09:03:45 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8294

           Summary: Obvious inline missed
           Product: libraries
           Version: 1.0
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu


This (from GCC PR45791):

struct Base {
        virtual ~Base() {}
        virtual void f() = 0;
};
struct Derived : Base {
        Derived();
        virtual void f() {}
};
struct Foo {
        Foo(Base&);
};
Derived::Derived() {
        Foo foo(*this);
}
Foo::Foo(Base& base) {
        base.f();
}
int main() {
        Derived d;
}

Compiles into this with clang -O3:

... lots of stuff...

define void @_ZN7DerivedC2Ev(%struct.Derived* %this) ssp align 2 {
entry:
  %0 = bitcast %struct.Derived* %this to i32 (...)***
  %1 = bitcast %struct.Derived* %this to i8***
  store i8** getelementptr inbounds ([5 x i8*]* @_ZTV7Derived, i64 0, i64 2),
i8*** %1, 
align 8
  call void @_ZN7Derived1fEv(%struct.Derived* %this)
  ret void
}

define linkonce_odr void @_ZN7Derived1fEv(%struct.Derived* nocapture %this)
nounwind readnone ssp align 2 {
entry:
  ret void
}

It looks like we devirtualized a bunch of stuff but didn't inline the call to
_ZN7Derived1fEv.

incidentally, searching the GCC bugzilla for 'mozilla' turns up a bunch of
other related examples.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list