mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-17 15:38:40 +00:00
Preserve tail marker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21737 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1b49141821
commit
a9e9211bbb
@ -4232,6 +4232,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
|||||||
Args, Caller->getName(), Caller);
|
Args, Caller->getName(), Caller);
|
||||||
} else {
|
} else {
|
||||||
NC = new CallInst(Callee, Args, Caller->getName(), Caller);
|
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...
|
// Insert a cast of the return type as necessary...
|
||||||
|
@ -150,6 +150,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) {
|
|||||||
|
|
||||||
// Create the call to Malloc...
|
// Create the call to Malloc...
|
||||||
CallInst *MCall = new CallInst(MallocFunc, MallocArgs, "", I);
|
CallInst *MCall = new CallInst(MallocFunc, MallocArgs, "", I);
|
||||||
|
MCall->setTailCall();
|
||||||
|
|
||||||
// Create a cast instruction to convert to the right type...
|
// Create a cast instruction to convert to the right type...
|
||||||
Value *MCast;
|
Value *MCast;
|
||||||
@ -180,7 +181,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) {
|
|||||||
FreeArgs.push_back(Constant::getNullValue(FreeFTy->getParamType(i)));
|
FreeArgs.push_back(Constant::getNullValue(FreeFTy->getParamType(i)));
|
||||||
|
|
||||||
// Insert a call to the free function...
|
// Insert a call to the free function...
|
||||||
new CallInst(FreeFunc, FreeArgs, "", I);
|
(new CallInst(FreeFunc, FreeArgs, "", I))->setTailCall();
|
||||||
|
|
||||||
// Delete the old free instruction
|
// Delete the old free instruction
|
||||||
I = --BBIL.erase(I);
|
I = --BBIL.erase(I);
|
||||||
|
@ -195,7 +195,7 @@ void LowerInvoke::writeAbortMessage(Instruction *IB) {
|
|||||||
Args[i] = ConstantExpr::getCast(cast<Constant>(Args[i]),
|
Args[i] = ConstantExpr::getCast(cast<Constant>(Args[i]),
|
||||||
FT->getParamType(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);
|
writeAbortMessage(UI);
|
||||||
|
|
||||||
// Insert a call to abort()
|
// 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
|
// Insert a return instruction. This really should be a "barrier", as it
|
||||||
// is unreachable.
|
// is unreachable.
|
||||||
@ -375,7 +375,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
|
|||||||
writeAbortMessage(RI);
|
writeAbortMessage(RI);
|
||||||
|
|
||||||
// Insert a call to abort()
|
// Insert a call to abort()
|
||||||
new CallInst(AbortFn, std::vector<Value*>(), "", RI);
|
(new CallInst(AbortFn, std::vector<Value*>(), "", RI))->setTailCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Changed;
|
return Changed;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user