[PATCH] Allow tail call optimization through multiple/nested struct extractions/insertions

Stephen Lin swlin at post.harvard.edu
Fri Apr 19 21:30:39 PDT 2013


Committed as r179924, with extra tests to ensure tail calls are not
generated in some plausible false positive cases.

On Fri, Apr 19, 2013 at 7:06 PM, Evan Cheng <evan.cheng at apple.com> wrote:
>
> On Apr 19, 2013, at 10:31 AM, Stephen Lin <swlin at post.harvard.edu> wrote:
>
>>> This part confuses a bit:
>>>
>>> +static bool sameNoopInput(const Value *V1, const Value *V2,
>>> +                          SmallVectorImpl<unsigned> &Els1,
>>> +                          SmallVectorImpl<unsigned> &Els2,
>>> +                          const TargetLowering &TLI) {
>>> +  using std::swap;
>>> +  bool swapParity;
>>> +  bool isSame = sameNoopInput(V1, V2, Els1, Els2, swapParity, TLI);
>>> +  if (swapParity) {
>>> +    // Revert to origin Els1 and Els2 to avoid confusing recursive calls
>>> +    swap(V1, V2);
>>> +    swap(Els1, Els2);
>>> +  }
>>> +  return isSame;
>>> +}
>>>
>>> Why is it necessary to swap V1 and V2? They are not passed by reference. Otherwise, I don't see any issue with the patch. Please update it and if LNT testing looks fine please commit the patch.
>>>
>>
>> Oh, that's embarrassing :) I got rid of that and consolidated it back
>> into one function.
>>
>> Yes, LNT looks fine. Also, I don't have commit access, actually, so
>> could you commit for me?
>
> Please follow the instruction to request commit access first:
> http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access
>
> You should commit it. Please do be on the look out for test failures. Like I said, the patch looks good but tail call can be tricky.
>
> Evan
>
>>
>> Thanks,
>> Stephen
>> <tail-call-nested-struct.patch>
>



More information about the llvm-commits mailing list