aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-02-03 03:55:59 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-02-03 03:55:59 +0000
commitfebc81680c80a53f15f85b1812cba07fc179b9fd (patch)
treefd7bb78079527e669515e681dcf1e6122a7afd7f /lib/CodeGen
parent2e235a826d2f65a064b2a39b27c775d0adf8b7c3 (diff)
Revert 94937 and move the noreturn check to codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95198 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 495418d999..3a25714f07 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4205,8 +4205,13 @@ isInTailCallPosition(CallSite CS, Attributes CalleeRetAttr,
const ReturnInst *Ret = dyn_cast<ReturnInst>(Term);
const Function *F = ExitBB->getParent();
- // The block must end in a return statement or an unreachable.
- if (!Ret && !isa<UnreachableInst>(Term)) return false;
+ // The block must end in a return statement.
+ // FIXME: Disallow tailcall if the block ends in an unreachable for now.
+ // The way tailcall optimization is currently implemented means it will
+ // add an epilogue followed by a jump. That is not profitable. Also, if
+ // the callee is a special function (e.g. longjmp on x86), it can end up
+ // causing miscompilation that has not been fully understood.
+ if (!Ret) return false;
// Unless we are explicitly forcing tailcall optimization do not tailcall if
// the called function is bitcast'ed. The analysis may not be entirely