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:
Reid Kleckner committed 2014-04-24 20:14:34 +00:00
1 parent 0fbb1e91e5
commit 5772b77789
21 files changed
+334 -30

No files matched your search

+7 -2
View File
@@ -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;
}