Add 'musttail' marker to call instructions
This is similar to the 'tail' marker, except that it guarantees that tail call optimization will occur. It also comes with convervative IR verification rules that ensure that tail call optimization is possible. Reviewers: nicholas Differential Revision: http://llvm-reviews.chandlerc.com/D3240 llvm-svn: 207143
This commit is contained in:
@@ -2994,8 +2994,13 @@ error_code BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
I = CallInst::Create(Callee, Args);
|
||||
InstructionList.push_back(I);
|
||||
cast<CallInst>(I)->setCallingConv(
|
||||
static_cast<CallingConv::ID>(CCInfo>>1));
|
||||
cast<CallInst>(I)->setTailCall(CCInfo & 1);
|
||||
static_cast<CallingConv::ID>((~(1U << 14) & CCInfo) >> 1));
|
||||
CallInst::TailCallKind TCK = CallInst::TCK_None;
|
||||
if (CCInfo & 1)
|
||||
TCK = CallInst::TCK_Tail;
|
||||
if (CCInfo & (1 << 14))
|
||||
TCK = CallInst::TCK_MustTail;
|
||||
cast<CallInst>(I)->setTailCallKind(TCK);
|
||||
cast<CallInst>(I)->setAttributes(PAL);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user