diff options
author | Chris Lattner <sabre@nondot.org> | 2005-05-06 06:48:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-05-06 06:48:21 +0000 |
commit | a9e9211bbb2a47f4d6db61ef100ccebe4c46c0ff (patch) | |
tree | cae5f946548b195afbbfa4888744bc3434a8ab32 /lib | |
parent | 1b49141821e98e4321bfe6234c7001c836b2a289 (diff) | |
download | llvm-a9e9211bbb2a47f4d6db61ef100ccebe4c46c0ff.tar.gz llvm-a9e9211bbb2a47f4d6db61ef100ccebe4c46c0ff.tar.bz2 llvm-a9e9211bbb2a47f4d6db61ef100ccebe4c46c0ff.tar.xz |
Preserve tail marker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Utils/LowerAllocations.cpp | 3 | ||||
-rw-r--r-- | lib/Transforms/Utils/LowerInvoke.cpp | 6 |
3 files changed, 7 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 51141162bf..72b45319c0 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -4232,6 +4232,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { Args, Caller->getName(), Caller); } else { NC = new CallInst(Callee, Args, Caller->getName(), Caller); + if (cast<CallInst>(Caller)->isTailCall()) + cast<CallInst>(NC)->setTailCall(); } // Insert a cast of the return type as necessary... diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp index 71b45fdfea..1502fab759 100644 --- a/lib/Transforms/Utils/LowerAllocations.cpp +++ b/lib/Transforms/Utils/LowerAllocations.cpp @@ -150,6 +150,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { // Create the call to Malloc... CallInst *MCall = new CallInst(MallocFunc, MallocArgs, "", I); + MCall->setTailCall(); // Create a cast instruction to convert to the right type... Value *MCast; @@ -180,7 +181,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { FreeArgs.push_back(Constant::getNullValue(FreeFTy->getParamType(i))); // Insert a call to the free function... - new CallInst(FreeFunc, FreeArgs, "", I); + (new CallInst(FreeFunc, FreeArgs, "", I))->setTailCall(); // Delete the old free instruction I = --BBIL.erase(I); diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index fee18aa77c..b751bc0d26 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -195,7 +195,7 @@ void LowerInvoke::writeAbortMessage(Instruction *IB) { Args[i] = ConstantExpr::getCast(cast<Constant>(Args[i]), FT->getParamType(i)); - new CallInst(WriteFn, Args, "", IB); + (new CallInst(WriteFn, Args, "", IB))->setTailCall(); } } @@ -225,7 +225,7 @@ bool LowerInvoke::insertCheapEHSupport(Function &F) { writeAbortMessage(UI); // Insert a call to abort() - new CallInst(AbortFn, std::vector<Value*>(), "", UI); + (new CallInst(AbortFn, std::vector<Value*>(), "", UI))->setTailCall(); // Insert a return instruction. This really should be a "barrier", as it // is unreachable. @@ -375,7 +375,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) { writeAbortMessage(RI); // Insert a call to abort() - new CallInst(AbortFn, std::vector<Value*>(), "", RI); + (new CallInst(AbortFn, std::vector<Value*>(), "", RI))->setTailCall(); } return Changed; |