This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/41012] New: Missing inlining after indirect call promotion


Compiling the following test case with FDO, virtual call base->Foo(id) is
promoted/specialized in valueProf transformation. However the resulting direct
call is not inlined due to type mismatch.

The problem is that the  2nd ARG_TYPE associated with the indirect call is a
record type, but the actual argument type is a reference/pointer type -- this
is required by C++ ABI for passing record typed object with nontrival
constructor. During gimple-lowering, the callsite is marked as
cannot_be_inlined and this attribute is copied to the promoted direct callsite.

// ========
class DocId {
 public:
 DocId() { }
 DocId(const DocId &other) {  }
};

class Base {
 public:
 virtual void Foo(DocId id) { }
};

class Super: public Base {
 public:
 void Foo(DocId id) { }
 void Bar(Base *base, DocId id);
};

void Super::Bar(Base *base, DocId id) {
 Super::Foo(id); // direct call is inlined
 base->Foo(id); // indirect call is marked do not inline
}

int main(void)
{
 Base bah;
 Super baz;
 DocId gid;

 baz.Bar(&bah, gid);
 return 0;
}


-- 
           Summary: Missing inlining after indirect call promotion
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: davidxl at gcc dot gnu dot org
        ReportedBy: davidxl at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41012


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]