diff options
author | Evan Cheng <evan.cheng@apple.com> | 2010-01-31 00:59:31 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2010-01-31 00:59:31 +0000 |
commit | 56a5886b20433569e5eb9c5b1ad350ef0c0e0596 (patch) | |
tree | 8fc9464d61ba12128eebcff14f3218c2d5293792 /lib/Transforms/Scalar | |
parent | 3ed6f876c8c30d82dceccfdd7e3f1774a85adc7c (diff) | |
download | external_llvm-56a5886b20433569e5eb9c5b1ad350ef0c0e0596.zip external_llvm-56a5886b20433569e5eb9c5b1ad350ef0c0e0596.tar.gz external_llvm-56a5886b20433569e5eb9c5b1ad350ef0c0e0596.tar.bz2 |
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
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/TailRecursionElimination.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp index 162d902..913dd73 100644 --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -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; } |