summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2017-02-13 19:58:28 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2017-02-13 19:58:28 +0000
commit8f3df731dc3db361e99d5ef2b86b760b511e70dc (patch)
tree1a7e456d0d550df00a155329c2f323e882284f2e /llvm/lib/CodeGen
parent2b33f65317aa8f4145432f902c12d5a127bcbffe (diff)
downloadbcm5719-llvm-8f3df731dc3db361e99d5ef2b86b760b511e70dc.tar.gz
bcm5719-llvm-8f3df731dc3db361e99d5ef2b86b760b511e70dc.zip
swiftcc: Don't emit tail calls from callers with swifterror parameters
Backends don't support this yet. They would have to move to the swifterror register before the tail call to make sure it is live-in to the call. rdar://30495920 llvm-svn: 294982
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 5966069d31b..d59419ec09f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -5916,6 +5916,15 @@ void SelectionDAGBuilder::LowerCallTo(ImmutableCallSite CS, SDValue Callee,
const Value *SwiftErrorVal = nullptr;
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+
+ // We can't tail call inside a function with a swifterror argument. Lowering
+ // does not support this yet. It would have to move into the swifterror
+ // register before the call.
+ auto *Caller = CS.getInstruction()->getParent()->getParent();
+ if (TLI.supportSwiftError() &&
+ Caller->getAttributes().hasAttrSomewhere(Attribute::SwiftError))
+ isTailCall = false;
+
for (ImmutableCallSite::arg_iterator i = CS.arg_begin(), e = CS.arg_end();
i != e; ++i) {
const Value *V = *i;
OpenPOWER on IntegriCloud