[PATCH] Add 'musttail' marker to call instructions
Reid Kleckner
rnk at google.com
Tue Apr 1 17:46:47 PDT 2014
On Mon, Mar 31, 2014 at 8:27 PM, Nick Lewycky <nlewycky at google.com> wrote:
> On 31 March 2014 20:20, David Majnemer <david.majnemer at gmail.com> wrote:
>
>>
>>
>> ================
>> Comment at: include/llvm/IR/Instructions.h:1291
>> @@ -1281,1 +1290,3 @@
>> + }
>> void setTailCall(bool isTC = true) {
>> + setInstructionSubclassData((getSubclassDataFromInstruction() & ~3) |
>> ----------------
>> Wouldn't it make more sense to have `setTailCall` take an `enum
>> TailCallKind` instead of having both `setTailCall` and `setTailCallKind` ?
>
>
I was nervous about implicit integral conversions from the enum to bool
allowing old code to silently compile. I could see removing setTailCall
and leaving the new setter.
> The point of having setTailCall is that tail-callness is a mutable
> property throughout the IR. The point of musttail is that it must be a tail
> call, hence it isn't mutable.
>
> I'm not sure whether there should be a setter at all and instead we should
> require that musttail must be set at creation time and is immutable, or
> whether we should permit upgrading normal-tail-call to musttail, but you
> can't downgrade one.
>
FWIW, LLVM IR is already pretty mutable. It's possible to slap
alwaysinline on a function after the fact, and alwaysinline has similar
correctness requirements.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140401/57474f54/attachment.html>
More information about the llvm-commits
mailing list