summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/Analysis.cpp
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2013-08-20 08:36:50 +0000
committerMichael Gottesman <mgottesman@apple.com>2013-08-20 08:36:50 +0000
commitce0e4c263b3bc00d35ad2dc4717797e588958610 (patch)
tree3da0976ce9728b26d5b2b66329f7e8339b781ad5 /llvm/lib/CodeGen/Analysis.cpp
parentaf0ca63cec8c583e1de9f33de2faf6f9b645dc1e (diff)
downloadbcm5719-llvm-ce0e4c263b3bc00d35ad2dc4717797e588958610.tar.gz
bcm5719-llvm-ce0e4c263b3bc00d35ad2dc4717797e588958610.zip
[stackprotector] Refactor out the end of isInTailCallPosition into the function returnTypeIsEligibleForTailCall.
This allows me to use returnTypeIsEligibleForTailCall in the stack protector pass. rdar://13935163 llvm-svn: 188765
Diffstat (limited to 'llvm/lib/CodeGen/Analysis.cpp')
-rw-r--r--llvm/lib/CodeGen/Analysis.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp
index 332a0425514..1600c67a7c6 100644
--- a/llvm/lib/CodeGen/Analysis.cpp
+++ b/llvm/lib/CodeGen/Analysis.cpp
@@ -510,6 +510,13 @@ bool llvm::isInTailCallPosition(ImmutableCallSite CS,
return false;
}
+ return returnTypeIsEligibleForTailCall(ExitBB->getParent(), I, Ret, TLI);
+}
+
+bool llvm::returnTypeIsEligibleForTailCall(const Function *F,
+ const Instruction *I,
+ const ReturnInst *Ret,
+ const TargetLoweringBase &TLI) {
// If the block ends with a void return or unreachable, it doesn't matter
// what the call's return type is.
if (!Ret || Ret->getNumOperands() == 0) return true;
@@ -519,7 +526,7 @@ bool llvm::isInTailCallPosition(ImmutableCallSite CS,
if (isa<UndefValue>(Ret->getOperand(0))) return true;
// Make sure the attributes attached to each return are compatible.
- AttrBuilder CallerAttrs(ExitBB->getParent()->getAttributes(),
+ AttrBuilder CallerAttrs(F->getAttributes(),
AttributeSet::ReturnIndex);
AttrBuilder CalleeAttrs(cast<CallInst>(I)->getAttributes(),
AttributeSet::ReturnIndex);
OpenPOWER on IntegriCloud