summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/Analysis.cpp
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2018-09-26 10:46:18 +0000
committerDavid Green <david.green@arm.com>2018-09-26 10:46:18 +0000
commit353cb3d4e524555c3bc9b7e0b4f857675c08ea41 (patch)
tree5a02391c7e707ec05d041c5d55a03ce3daaff6ab /llvm/lib/CodeGen/Analysis.cpp
parent67572004df09bb342fc8ef92be96b5963071b3a6 (diff)
downloadbcm5719-llvm-353cb3d4e524555c3bc9b7e0b4f857675c08ea41.tar.gz
bcm5719-llvm-353cb3d4e524555c3bc9b7e0b4f857675c08ea41.zip
[CodeGen] Enable tail calls for functions with NonNull attributes.
Adding NonNull as attributes to returned pointers has the unfortunate side effect of disabling tail calls. This patch ignores the NonNull attribute when we decide whether to tail merge, in the same way that we ignore the NoAlias attribute, as it has no affect on the call sequence. Differential Revision: https://reviews.llvm.org/D52238 llvm-svn: 343091
Diffstat (limited to 'llvm/lib/CodeGen/Analysis.cpp')
-rw-r--r--llvm/lib/CodeGen/Analysis.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp
index 7c1fb6879a6..b769e92590f 100644
--- a/llvm/lib/CodeGen/Analysis.cpp
+++ b/llvm/lib/CodeGen/Analysis.cpp
@@ -519,10 +519,12 @@ bool llvm::attributesPermitTailCall(const Function *F, const Instruction *I,
AttrBuilder CalleeAttrs(cast<CallInst>(I)->getAttributes(),
AttributeList::ReturnIndex);
- // Noalias is completely benign as far as calling convention goes, it
- // shouldn't affect whether the call is a tail call.
+ // NoAlias and NonNull are completely benign as far as calling convention
+ // goes, they shouldn't affect whether the call is a tail call.
CallerAttrs.removeAttribute(Attribute::NoAlias);
CalleeAttrs.removeAttribute(Attribute::NoAlias);
+ CallerAttrs.removeAttribute(Attribute::NonNull);
+ CalleeAttrs.removeAttribute(Attribute::NonNull);
if (CallerAttrs.contains(Attribute::ZExt)) {
if (!CalleeAttrs.contains(Attribute::ZExt))
OpenPOWER on IntegriCloud