[LLVMdev] Implementing devirtualization

Eli Friedman eli.friedman at gmail.com
Thu Dec 8 17:10:30 PST 2011


On Thu, Dec 8, 2011 at 4:50 PM, David Blaikie <dblaikie at gmail.com> wrote:
> On Thu, Dec 8, 2011 at 4:26 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>> On Thu, Dec 8, 2011 at 2:11 PM, Vitor Luis Menezes <vitor at utexas.edu> wrote:
>>> It's a bit long-winded, but from looking at the code it's clear that no
>>> virtual calls are actually necessary, yet Clang and LLVM generated both of
>>> them.
>>
>> Try with LLVM trunk; with some recent changes, LLVM's GVN is now a bit
>> more powerful in situations like this.
>
> Yep, looks better now (still lots of work done to call new/delete - I
> guess I'd have to LTO that with the standard library to get them to go
> away), it boils down to "ret i32 24"

We wouldn't really need LTO, just a bit of knowledge of the builtin
operator new and delete (one easy optimization would be to eliminate
the null checks because _Znwm never returns null.)

-Eli



More information about the llvm-dev mailing list