Skip to content

Commit 1599ddd

Browse files
committed
[Clang] Attribute NoFPClass should not prevent tail call optimization.
Fixes #111950
1 parent c526eb8 commit 1599ddd

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

llvm/lib/CodeGen/Analysis.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,10 @@ bool llvm::attributesPermitTailCall(const Function *F, const Instruction *I,
596596

597597
// Following attributes are completely benign as far as calling convention
598598
// goes, they shouldn't affect whether the call is a tail call.
599-
for (const auto &Attr :
600-
{Attribute::Alignment, Attribute::Dereferenceable,
601-
Attribute::DereferenceableOrNull, Attribute::NoAlias,
602-
Attribute::NonNull, Attribute::NoUndef, Attribute::Range}) {
599+
for (const auto &Attr : {Attribute::Alignment, Attribute::Dereferenceable,
600+
Attribute::DereferenceableOrNull, Attribute::NoAlias,
601+
Attribute::NonNull, Attribute::NoUndef,
602+
Attribute::Range, Attribute::NoFPClass}) {
603603
CallerAttrs.removeAttribute(Attr);
604604
CalleeAttrs.removeAttribute(Attr);
605605
}

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ bool TargetLowering::isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
6161
// the return. Ignore following attributes because they don't affect the
6262
// call sequence.
6363
AttrBuilder CallerAttrs(F.getContext(), F.getAttributes().getRetAttrs());
64-
for (const auto &Attr :
65-
{Attribute::Alignment, Attribute::Dereferenceable,
66-
Attribute::DereferenceableOrNull, Attribute::NoAlias,
67-
Attribute::NonNull, Attribute::NoUndef, Attribute::Range})
64+
for (const auto &Attr : {Attribute::Alignment, Attribute::Dereferenceable,
65+
Attribute::DereferenceableOrNull, Attribute::NoAlias,
66+
Attribute::NonNull, Attribute::NoUndef,
67+
Attribute::Range, Attribute::NoFPClass})
6868
CallerAttrs.removeAttribute(Attr);
6969

7070
if (CallerAttrs.hasAttributes())
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s
3+
4+
define dso_local noundef nofpclass(nan inf) float @_Z3foof(float noundef nofpclass(nan inf) %0) {
5+
; CHECK-LABEL: _Z3foof:
6+
; CHECK: # %bb.0:
7+
; CHECK-NEXT: jmp expf@PLT # TAILCALL
8+
%2 = tail call fast float @llvm.exp.f32(float %0)
9+
ret float %2
10+
}

0 commit comments

Comments
 (0)