Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/Analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,10 @@ 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.
for (const auto &Attr :
{Attribute::Alignment, Attribute::Dereferenceable,
Attribute::DereferenceableOrNull, Attribute::NoAlias,
Attribute::NonNull, Attribute::NoUndef, Attribute::Range}) {
for (const auto &Attr : {Attribute::Alignment, Attribute::Dereferenceable,
Attribute::DereferenceableOrNull, Attribute::NoAlias,
Attribute::NonNull, Attribute::NoUndef,
Attribute::Range, Attribute::NoFPClass}) {
CallerAttrs.removeAttribute(Attr);
CalleeAttrs.removeAttribute(Attr);
}
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ bool TargetLowering::isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
// the return. Ignore following attributes because they don't affect the
// call sequence.
AttrBuilder CallerAttrs(F.getContext(), F.getAttributes().getRetAttrs());
for (const auto &Attr :
{Attribute::Alignment, Attribute::Dereferenceable,
Attribute::DereferenceableOrNull, Attribute::NoAlias,
Attribute::NonNull, Attribute::NoUndef, Attribute::Range})
for (const auto &Attr : {Attribute::Alignment, Attribute::Dereferenceable,
Attribute::DereferenceableOrNull, Attribute::NoAlias,
Attribute::NonNull, Attribute::NoUndef,
Attribute::Range, Attribute::NoFPClass})
CallerAttrs.removeAttribute(Attr);

if (CallerAttrs.hasAttributes())
Expand Down
13 changes: 13 additions & 0 deletions llvm/test/CodeGen/X86/tailcall-nofpclass.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s

; Ensures that taillcall optimization can still be
; performed when nofpclass is used.

define noundef nofpclass(nan inf) float @_Z3foof(float noundef nofpclass(nan inf) %0) {
; CHECK-LABEL: _Z3foof:
; CHECK: # %bb.0:
; CHECK-NEXT: jmp expf@PLT # TAILCALL
%2 = tail call float @llvm.exp.f32(float %0)
ret float %2
}
Loading