[LLVMdev] should AlwaysInliner inline this case?
Liu Xin
navy.xliu at gmail.com
Mon Jan 5 05:50:38 PST 2015
hi, Pete,
I understand InstCombine may simplify bitcast to nothing, but the order
matters. AlwaysInliner happens in very early stage, and we never call it
again. if InstCombine works, can we invoke it before Inliner?
thanks,
--lx
On Mon, Jan 5, 2015 at 5:40 PM, Pete Cooper <peter_cooper at apple.com> wrote:
> Hi lx, Philip
>
> I've seen an instcombine which helps with this situation. It fires when
> the function types on both sides of the bitcast have the same number of
> operands and compatible types. It then adds bitcasts on the arguments and
> removes the one on the called function.
>
> I don't have IR to hand, but it would be worth passing your IR through
> instcombine to see if that helps you.
>
> The idea of improving the inliner is also great, but you may find that
> it's needed for cases other than this one if i'm right about the
> instcombine.
>
> Thanks
> Pete
>
> Sent from my iPhone
>
> On Jan 5, 2015, at 3:16 AM, Liu Xin <navy.xliu at gmail.com> wrote:
>
> Philip,
>
> I post here because I think AlwaysInliner should inline it. I want to
> detect the indirect calls for Inliner, and I want to hear inputs.
>
> let me define indirect call first in my idea. In one single expression,
> one function may be subject to bitcast more than one time. we can detect
> this situation and treat it as a regular call of last function, is that
> okay?
>
> thanks,
> --lx
>
>
> On Mon, Jan 5, 2015 at 7:32 AM, Philip Reames <listmail at philipreames.com>
> wrote:
>
>> On 01/04/2015 12:04 AM, Liu Xin wrote:
>>
>>>
>>> %294= callfloatbitcast (float(float, float*)* @__gpu_modff to
>>> float(float, i64)*)(float%293, i64 %preg.212.addr.0)
>>>
>>> as you may know, some gpu backends don't support function call. we need
>>> to make sure to inline all functions here. however, Inliner can not figure
>>> out that this is a valid callsite in this form. actually, it is. in C
>>> words, cast a function and then call should be treat as callsite, right?
>>>
>>> Generally, the inliner doesn't do much with indirect calls, but given
>> there is no simpler canonical case here, I expect we'll have to.
>>
>> Its possible we might even want to define this as a direct call. I'm not
>> sure what the expectations are with regards to the type of the function
>> being called and the type of the callsite. I suspect a lot of code would
>> get confused if getCalledFunction returned __gpu_modff with it's unbitcast
>> type. That's possibly something we should fix though.
>>
>> We'll want to get other folks input here, but a small patch to the
>> inliner to handle this case would seem reasonable to me.
>>
>> Philip
>>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150105/bda1a63b/attachment.html>
More information about the llvm-dev
mailing list