[LTO] Fix C++ thunks

Chris Lattner clattner@apple.com
Wed Dec 17 21:31:00 GMT 2008

On Dec 17, 2008, at 10:04 AM, Mark Mitchell wrote:

> Diego Novillo wrote:
>> [ CCing jason and mark, to make sure I'm not missing anything
>>  obvious in the C++ side. ]
>> This patch is the initial step to make thunks work with LTO.
>> Essentially, this forces cc1plus to always emit non-asm thunks,
>> which is a performance problem, but I think I know how to address
>> it.
> I think your patch is plausible.  Obviously, we need to get the asm
> thunks back in to recover performance (and correctness, for  
> varargs).  I
> think GIMPLE_THUNK_CALL is a plausible solution to that.
> A few things you should think about:
> 1. Although we've never implemented it, one of the ideas with thunks  
> was
> that you could fall through into the main function body, rather than
> jump to it.  That avoids a costly, often mis-predicted branch.  So, we
> shouldn't do anything that makes that harder.

When are these branches expensive?  My understanding is that all  
reasonable desktop hardware (at least) has "perfect" prediction for  
unconditional branches.


More information about the Gcc-patches mailing list