summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AArch64/AArch64CallLowering.cpp
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2019-09-11 23:44:16 +0000
committerJessica Paquette <jpaquette@apple.com>2019-09-11 23:44:16 +0000
commite297ad1bd964f112787624956a83388b29b85af4 (patch)
tree16558690406f9927a78b0e650b4a33ffb41b5789 /llvm/lib/Target/AArch64/AArch64CallLowering.cpp
parent33f01663f7a934e7e1afcbbe7d2693452e050d91 (diff)
downloadbcm5719-llvm-e297ad1bd964f112787624956a83388b29b85af4.tar.gz
bcm5719-llvm-e297ad1bd964f112787624956a83388b29b85af4.zip
[GlobalISel][AArch64] Check caller for swifterror params in tailcall eligibility
Before, we only checked the callee for swifterror. However, we should also be checking the caller to see if it has a swifterror parameter. Since we don't currently handle outgoing arguments, this didn't show up in the swifterror.ll testcase. Also, remove the swifterror checks from call-translator-tail-call.ll, since they are covered by the existing swifterror testing. Better to have it all in one place. Differential Revision: https://reviews.llvm.org/D67465 llvm-svn: 371692
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64CallLowering.cpp')
-rw-r--r--llvm/lib/Target/AArch64/AArch64CallLowering.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64CallLowering.cpp b/llvm/lib/Target/AArch64/AArch64CallLowering.cpp
index 77944186c45..1ca89ba33a5 100644
--- a/llvm/lib/Target/AArch64/AArch64CallLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64CallLowering.cpp
@@ -493,11 +493,15 @@ bool AArch64CallLowering::isEligibleForTailCallOptimization(
// caller has an argument with "inreg" attribute.
//
// FIXME: Check whether the callee also has an "inreg" argument.
+ //
+ // When the caller has a swifterror argument, we don't want to tail call
+ // because would have to move into the swifterror register before the
+ // tail call.
if (any_of(CallerF.args(), [](const Argument &A) {
- return A.hasByValAttr() || A.hasInRegAttr();
+ return A.hasByValAttr() || A.hasInRegAttr() || A.hasSwiftErrorAttr();
})) {
- LLVM_DEBUG(dbgs() << "... Cannot tail call from callers with byval or "
- "inreg arguments.\n");
+ LLVM_DEBUG(dbgs() << "... Cannot tail call from callers with byval, "
+ "inreg, or swifterror arguments\n");
return false;
}
OpenPOWER on IntegriCloud