diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2010-02-03 03:55:59 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2010-02-03 03:55:59 +0000 |
| commit | 27a41d5473041c2b6d9459ddd2299381dad9678d (patch) | |
| tree | 98835a2da77aea26670acb34a89e5abc46ff2f0b /llvm/lib/CodeGen | |
| parent | 6a6f9cc634f6e8eb29cfa1060939c4daa90afaf0 (diff) | |
| download | bcm5719-llvm-27a41d5473041c2b6d9459ddd2299381dad9678d.tar.gz bcm5719-llvm-27a41d5473041c2b6d9459ddd2299381dad9678d.zip | |
Revert 94937 and move the noreturn check to codegen.
llvm-svn: 95198
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 495418d999e..3a25714f07c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/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 |

