diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp --- a/llvm/lib/CodeGen/Analysis.cpp +++ b/llvm/lib/CodeGen/Analysis.cpp @@ -560,14 +560,12 @@ // 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)) diff --git a/llvm/test/CodeGen/X86/tail-calls-compatible-attrs.ll b/llvm/test/CodeGen/X86/tail-calls-compatible-attrs.ll --- a/llvm/test/CodeGen/X86/tail-calls-compatible-attrs.ll +++ b/llvm/test/CodeGen/X86/tail-calls-compatible-attrs.ll @@ -34,3 +34,19 @@ %ret = tail call dereferenceable_or_null(8) i8* @foo() ret i8* %ret } + +define align 8 i8* @test5() nounwind { +; CHECK-LABEL: test5: +; CHECK: # %bb.0: +; CHECK-NEXT: jmp foo # TAILCALL + %ret = tail call i8* @foo() + ret i8* %ret +} + +define i8* @test6() nounwind { +; CHECK-LABEL: test6: +; CHECK: # %bb.0: +; CHECK-NEXT: jmp foo # TAILCALL + %ret = tail call align 8 i8* @foo() + ret i8* %ret +}