[llvm-commits] patch: teach deadargelim to work on externally visible functions!

Török Edwin edwintorok at gmail.com
Mon Jan 4 05:18:04 PST 2010


On 2010-01-04 15:11, Duncan Sands wrote:
> Hi Edwin,
>
>>>> Since you already make optimizations based on the assumption that the
>>>> externally visible function you see
>>>> is the actual one [*] that is going to be called at runtime I think
>>>> there is a more general solution for this:
>>> ...
>>>> [*] which may not be true, it could be overridden via LD_PRELOAD or
>>>> other means.
>>> the call to mayBeOverridden in the patch is checking whether we are
>>> allowed to assume that the function body is definitive.
>>
>> It returns false for externalLinkage, yet you can override the symbol
>> from another shared lib.
>
> sure, but then you are invoking undefined behaviour.

If the optimizer already assumes that externalLinkage means no override
(which is a perfectly reasonable thing to do),
then why not do further optimizations based on this assumption, and
really call the function we see
(instead of going through the .plt and calling whatever that resolves to
at runtime).

Best regards,
--Edwin



More information about the llvm-commits mailing list