Hi,
This is related to pr45605.C test.
---- Reduced testcase
struct B {
virtual void Run(){};
};
struct D : public B {
virtual void Run() { };
};
int main() {
D d;
static_cast<B&>(d).Run();
}
With x86_64 linux the call to Run through object d is devirtualized.
Whereas it looks like in ia64 hp-ux it is not devirtualized.
-fdump-tree-fre1 output for both:
---- x86_64 linux:
MEM[(struct B *)&d]._vptr.B = &MEM[(void *)&_ZTV1B + 16B];
d.D.2197._vptr.B = &MEM[(void *)&_ZTV1D + 16B];
D.2248_1 = &MEM[(void *)&_ZTV1D + 16B];
D.2249_2 = Run;
D::Run (&d.D.2197);
d ={v} {CLOBBER};
return 0;
---- ia64 hp-ux:
MEM[(struct B *)&d]._vptr.B = &MEM[(void *)&_ZTV1B + 16B];
d.D.1878._vptr.B = &MEM[(void *)&_ZTV1D + 16B];
D.1929_1 = &MEM[(void *)&_ZTV1D + 16B];
D.1930_2 = (int (*__vtbl_ptr_type) ()) &MEM[(void *)&_ZTV1D + 16B];
OBJ_TYPE_REF(D.1930_2;&d.D.1878->0) (&d.D.1878);
Is it a bug (unexpected with O1 compilation) that it is not optimized to direct
call?
Regards,
Kannan