[LLVMdev] Missed devirtualization opportunities
John McCall
rjmccall at apple.com
Mon Oct 11 10:30:00 PDT 2010
On Oct 11, 2010, at 9:12 AM, Kenneth Uildriks wrote:
> 3. The front-end, recognizing that scribbling on an instance's vtbl
> pointer has undefined results, eliminated the loads of the vtbl
> pointer and replaced them with @classvtbl.TestVirtual. This would
> allow devirtualization within a function at least, but (I think) would
> do less to allow analysis to spot devirtualization opportunities
> across functions. (Although ArgPromotion could arrange to have the
> vtbl pointer passed in separately, and then inlining and/or partial
> specialization could be made to see that it's a pointer to a constant
> and thus add in the IndirectCallBonus)
There are always going to be cases that can only be deduced with
language knowledge. We already do some frontend de-virtualization;
this may just be a missing case. Can you post your test?
John.
More information about the llvm-dev
mailing list