[PATCH] Avoid FP conversions when calling bitcasted / alias functions

Eli Friedman eli.friedman at gmail.com
Fri Jul 26 19:07:52 PDT 2013


On Fri, Jul 26, 2013 at 6:49 PM, Matt Arsenault <arsenm2 at gmail.com> wrote:
>
> On Jul 26, 2013, at 17:32 , Eli Friedman <eli.friedman at gmail.com> wrote:
>
>> On Fri, Jul 26, 2013 at 5:15 PM, Matt Arsenault <arsenm2 at gmail.com> wrote:
>>>
>>> On Jul 26, 2013, at 17:04 , Eli Friedman <eli.friedman at gmail.com> wrote:
>>>
>>>> Something weird happened to the diff.
>>>>
>>>> Does it really make sense to zext and/or trunc the input here?
>>>>
>>> Sort of? I didn't really get why this code is here in the first place. I wast trying to preserve what it did except for the floating point part. It tries its best to call the underlying function with something valid when the types don't match. opt -lint says this is undefined (which should probably be fixed, since there are already other tests that check for specific behaviors here)
>>
>> IIRC, the care we really care about is the case where we have two
>> pointers with a mismatched pointee type; that can happen legitimately
>> with LTO, and we really want to eliminate the bitcast if possible.
>> What we do in other cases doesn't matter as much... arguably, we
>> should be conservative.
>>
>> -Eli
>
> test/Transforms/InstCombine/call.ll checks specifically for the zext/trunc cases

That doesn't mean it's right. :)

Really, the whole transformation is pretty unsafe overall; we probably
shouldn't be doing anything other than bitcasting pointers.

-Eli




More information about the llvm-commits mailing list