aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-03-24 18:07:13 +0000
committerBill Wendling <isanbard@gmail.com>2011-03-24 18:07:13 +0000
commit76c60c3241225cb5294e28e5211d0886207ce6e7 (patch)
treed965f826fa52857c16fa7e5a7aa25c3d74164032
parent5bc870c8c37a88a48b52866c3c92d58ee67c8e7a (diff)
--- Merging r128212 into '.':
U lib/Transforms/Scalar/CodeGenPrepare.cpp --- Merging r128217 into '.': G lib/Transforms/Scalar/CodeGenPrepare.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_29@128223 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/CodeGenPrepare.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 237b0a7d48..15d8c20f14 100644
--- a/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -602,7 +602,9 @@ bool CodeGenPrepare::DupRetToEnableTailCallOpts(ReturnInst *RI) {
if (&*BI != RI)
return false;
} else {
- if (&*BB->begin() != RI)
+ BasicBlock::iterator BI = BB->begin();
+ while (isa<DbgInfoIntrinsic>(BI)) ++BI;
+ if (&*BI != RI)
return false;
}
@@ -626,10 +628,12 @@ bool CodeGenPrepare::DupRetToEnableTailCallOpts(ReturnInst *RI) {
BasicBlock::InstListType &InstList = (*PI)->getInstList();
BasicBlock::InstListType::reverse_iterator RI = InstList.rbegin();
BasicBlock::InstListType::reverse_iterator RE = InstList.rend();
- if (++RI == RE)
+ do { ++RI; } while (RI != RE && isa<DbgInfoIntrinsic>(&*RI));
+ if (RI == RE)
continue;
+
CallInst *CI = dyn_cast<CallInst>(&*RI);
- if (CI && CI->getType()->isVoidTy() && TLI->mayBeEmittedAsTailCall(CI))
+ if (CI && CI->use_empty() && TLI->mayBeEmittedAsTailCall(CI))
TailCalls.push_back(CI);
}
}