summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-06 06:48:21 +0000
committerChris Lattner <sabre@nondot.org>2005-05-06 06:48:21 +0000
commit6aacb0f9da780f0d1b57b9681c6f858137824eed (patch)
tree07de5b232809bf39ab0da60102702843bc1cccba /llvm/lib/Transforms
parent9f3dced2c79044c6c31470066c3e418ee94798bc (diff)
downloadbcm5719-llvm-6aacb0f9da780f0d1b57b9681c6f858137824eed.tar.gz
bcm5719-llvm-6aacb0f9da780f0d1b57b9681c6f858137824eed.zip
Preserve tail marker
llvm-svn: 21737
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp2
-rw-r--r--llvm/lib/Transforms/Scalar/LowerAllocations.cpp3
-rw-r--r--llvm/lib/Transforms/Scalar/LowerInvoke.cpp6
3 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 51141162bfb..72b45319c0c 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/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/llvm/lib/Transforms/Scalar/LowerAllocations.cpp b/llvm/lib/Transforms/Scalar/LowerAllocations.cpp
index 71b45fdfeaa..1502fab759a 100644
--- a/llvm/lib/Transforms/Scalar/LowerAllocations.cpp
+++ b/llvm/lib/Transforms/Scalar/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/llvm/lib/Transforms/Scalar/LowerInvoke.cpp b/llvm/lib/Transforms/Scalar/LowerInvoke.cpp
index fee18aa77cf..b751bc0d26d 100644
--- a/llvm/lib/Transforms/Scalar/LowerInvoke.cpp
+++ b/llvm/lib/Transforms/Scalar/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;
OpenPOWER on IntegriCloud