mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-17 03:30:28 +00:00
Do not mark no-return calls tail calls. It'll screw up special calls like longjmp and it doesn't make much sense for performance reason. If my logic is faulty, please let me know.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94937 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3ed6f876c8
commit
56a5886b20
@ -184,10 +184,11 @@ bool TailCallElim::runOnFunction(Function &F) {
|
||||
if (!FunctionContainsEscapingAllocas)
|
||||
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
||||
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
|
||||
if (CallInst *CI = dyn_cast<CallInst>(I)) {
|
||||
CI->setTailCall();
|
||||
MadeChange = true;
|
||||
}
|
||||
if (CallInst *CI = dyn_cast<CallInst>(I))
|
||||
if (!CI->doesNotReturn()) {
|
||||
CI->setTailCall();
|
||||
MadeChange = true;
|
||||
}
|
||||
|
||||
return MadeChange;
|
||||
}
|
||||
|
12
test/Transforms/TailCallElim/no-return-calls.ll
Normal file
12
test/Transforms/TailCallElim/no-return-calls.ll
Normal file
@ -0,0 +1,12 @@
|
||||
; RUN: opt < %s -tailcallelim -S | FileCheck %s
|
||||
|
||||
define void @t() nounwind ssp {
|
||||
entry:
|
||||
; CHECK: entry:
|
||||
; CHECK: %0 = call i32 @foo()
|
||||
; CHECK: ret void
|
||||
%0 = call i32 @foo() nounwind noreturn
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i32 @foo()
|
Loading…
Reference in New Issue
Block a user