diff options
author | Dávid Bolvanský <david.bolvansky@gmail.com> | 2021-04-24 19:55:04 +0200 |
---|---|---|
committer | Dávid Bolvanský <david.bolvansky@gmail.com> | 2021-04-24 19:57:42 +0200 |
commit | ef2dc7ed9f76e3ae52eaa4def98d4dd11ac527c0 (patch) | |
tree | 6b46395235b9edc1add31c8d553c12580e5d2dce /llvm/lib/CodeGen/Analysis.cpp | |
parent | 0eb3299d28e4a9e235dec28d70a0df9e74e74722 (diff) | |
download | llvm-ef2dc7ed9f76e3ae52eaa4def98d4dd11ac527c0.zip llvm-ef2dc7ed9f76e3ae52eaa4def98d4dd11ac527c0.tar.gz llvm-ef2dc7ed9f76e3ae52eaa4def98d4dd11ac527c0.tar.bz2 |
[Analysis] Attribute alignment should not prevent tail call optimization
Fixes tail folding issue mentioned in D100879.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D101230
Diffstat (limited to 'llvm/lib/CodeGen/Analysis.cpp')
-rw-r--r-- | llvm/lib/CodeGen/Analysis.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp index 5d1b004..f3e46bc 100644 --- a/llvm/lib/CodeGen/Analysis.cpp +++ b/llvm/lib/CodeGen/Analysis.cpp @@ -560,14 +560,12 @@ bool llvm::attributesPermitTailCall(const Function *F, const Instruction *I, // Following attributes 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); - CallerAttrs.removeAttribute(Attribute::Dereferenceable); - CalleeAttrs.removeAttribute(Attribute::Dereferenceable); - CallerAttrs.removeAttribute(Attribute::DereferenceableOrNull); - CalleeAttrs.removeAttribute(Attribute::DereferenceableOrNull); + for (const auto &Attr : {Attribute::Alignment, Attribute::Dereferenceable, + Attribute::DereferenceableOrNull, Attribute::NoAlias, + Attribute::NonNull}) { + CallerAttrs.removeAttribute(Attr); + CalleeAttrs.removeAttribute(Attr); + } if (CallerAttrs.contains(Attribute::ZExt)) { if (!CalleeAttrs.contains(Attribute::ZExt)) |