Skip to content

Commit d11b7bd

Browse files
authored
[IR] Remove unsafe-fp-math attribute support (#164534)
Now this attribute is no longer recognized by backends, remove it.
1 parent dab8fb8 commit d11b7bd

File tree

3 files changed

+4
-48
lines changed

3 files changed

+4
-48
lines changed

llvm/include/llvm/IR/Attributes.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ def LessPreciseFPMAD : StrBoolAttr<"less-precise-fpmad">;
410410
def NoInfsFPMath : StrBoolAttr<"no-infs-fp-math">;
411411
def NoNansFPMath : StrBoolAttr<"no-nans-fp-math">;
412412
def NoSignedZerosFPMath : StrBoolAttr<"no-signed-zeros-fp-math">;
413-
def UnsafeFPMath : StrBoolAttr<"unsafe-fp-math">;
414413
def NoJumpTables : StrBoolAttr<"no-jump-tables">;
415414
def NoInlineLineTables : StrBoolAttr<"no-inline-line-tables">;
416415
def ProfileSampleAccurate : StrBoolAttr<"profile-sample-accurate">;
@@ -474,7 +473,6 @@ def : MergeRule<"setAND<LessPreciseFPMADAttr>">;
474473
def : MergeRule<"setAND<NoInfsFPMathAttr>">;
475474
def : MergeRule<"setAND<NoNansFPMathAttr>">;
476475
def : MergeRule<"setAND<NoSignedZerosFPMathAttr>">;
477-
def : MergeRule<"setAND<UnsafeFPMathAttr>">;
478476
def : MergeRule<"setOR<NoImplicitFloatAttr>">;
479477
def : MergeRule<"setOR<NoJumpTablesAttr>">;
480478
def : MergeRule<"setOR<ProfileSampleAccurateAttr>">;

llvm/test/Transforms/IROutliner/outlining-compatible-and-attribute-transfer.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
; attributes that should be transferred only if it is on all of the regions.
66

77
; This includes the attributes, no-nans-fp-math,
8-
; no-signed-zeros-fp-math, less-precise-fpmad, unsafe-fp-math, and
8+
; no-signed-zeros-fp-math, less-precise-fpmad, and
99
; no-infs-fp-math. Only when each instance of similarity has these attributes
1010
; can we say that the outlined function can have these attributes since that
1111
; is the more general case for these attributes.
@@ -101,7 +101,7 @@ entry:
101101
}
102102

103103
attributes #0 = { "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "less-precise-fpmad"="true"
104-
"unsafe-fp-math"="true" "no-infs-fp-math"="true"}
104+
"no-infs-fp-math"="true"}
105105

106106
; CHECK: define internal void @outlined_ir_func_0(ptr [[ARG0:%.*]], ptr [[ARG1:%.*]], ptr [[ARG2:%.*]]) [[ATTR1:#[0-9]+]] {
107107
; CHECK: entry_to_outline:
@@ -122,5 +122,5 @@ attributes #0 = { "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "les
122122
; CHECK-NEXT: [[CL:%.*]] = load i32, ptr [[ARG2]], align 4
123123

124124

125-
; CHECK: attributes [[ATTR1]] = { minsize optsize "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "unsafe-fp-math"="false" }
126-
; CHECK: attributes [[ATTR]] = { minsize optsize "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "unsafe-fp-math"="true" }
125+
; CHECK: attributes [[ATTR1]] = { minsize optsize "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" }
126+
; CHECK: attributes [[ATTR]] = { minsize optsize "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" }

llvm/test/Transforms/Inline/attributes.ll

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -601,46 +601,6 @@ define i32 @test_no-signed-zeros-fp-math3(i32 %i) "no-signed-zeros-fp-math"="tru
601601
; CHECK-NEXT: ret i32
602602
}
603603

604-
define i32 @unsafe-fp-math_callee0(i32 %i) "unsafe-fp-math"="false" {
605-
ret i32 %i
606-
; CHECK: @unsafe-fp-math_callee0(i32 %i) [[UNSAFE_FPMATH_FALSE:#[0-9]+]] {
607-
; CHECK-NEXT: ret i32
608-
}
609-
610-
define i32 @unsafe-fp-math_callee1(i32 %i) "unsafe-fp-math"="true" {
611-
ret i32 %i
612-
; CHECK: @unsafe-fp-math_callee1(i32 %i) [[UNSAFE_FPMATH_TRUE:#[0-9]+]] {
613-
; CHECK-NEXT: ret i32
614-
}
615-
616-
define i32 @test_unsafe-fp-math0(i32 %i) "unsafe-fp-math"="false" {
617-
%1 = call i32 @unsafe-fp-math_callee0(i32 %i)
618-
ret i32 %1
619-
; CHECK: @test_unsafe-fp-math0(i32 %i) [[UNSAFE_FPMATH_FALSE]] {
620-
; CHECK-NEXT: ret i32
621-
}
622-
623-
define i32 @test_unsafe-fp-math1(i32 %i) "unsafe-fp-math"="false" {
624-
%1 = call i32 @unsafe-fp-math_callee1(i32 %i)
625-
ret i32 %1
626-
; CHECK: @test_unsafe-fp-math1(i32 %i) [[UNSAFE_FPMATH_FALSE]] {
627-
; CHECK-NEXT: ret i32
628-
}
629-
630-
define i32 @test_unsafe-fp-math2(i32 %i) "unsafe-fp-math"="true" {
631-
%1 = call i32 @unsafe-fp-math_callee0(i32 %i)
632-
ret i32 %1
633-
; CHECK: @test_unsafe-fp-math2(i32 %i) [[UNSAFE_FPMATH_FALSE]] {
634-
; CHECK-NEXT: ret i32
635-
}
636-
637-
define i32 @test_unsafe-fp-math3(i32 %i) "unsafe-fp-math"="true" {
638-
%1 = call i32 @unsafe-fp-math_callee1(i32 %i)
639-
ret i32 %1
640-
; CHECK: @test_unsafe-fp-math3(i32 %i) [[UNSAFE_FPMATH_TRUE]] {
641-
; CHECK-NEXT: ret i32
642-
}
643-
644604
; Test that fn_ret_thunk_extern has no CompatRule; inlining is permitted.
645605
; Test that fn_ret_thunk_extern has no MergeRule; fn_ret_thunk_extern is not
646606
; propagated or dropped on the caller after inlining.
@@ -693,6 +653,4 @@ define i32 @loader_replaceable_caller() {
693653
; CHECK: attributes [[NO_NANS_FPMATH_TRUE]] = { "no-nans-fp-math"="true" }
694654
; CHECK: attributes [[NO_SIGNED_ZEROS_FPMATH_FALSE]] = { "no-signed-zeros-fp-math"="false" }
695655
; CHECK: attributes [[NO_SIGNED_ZEROS_FPMATH_TRUE]] = { "no-signed-zeros-fp-math"="true" }
696-
; CHECK: attributes [[UNSAFE_FPMATH_FALSE]] = { "unsafe-fp-math"="false" }
697-
; CHECK: attributes [[UNSAFE_FPMATH_TRUE]] = { "unsafe-fp-math"="true" }
698656
; CHECK: attributes [[FNRETTHUNK_EXTERN]] = { fn_ret_thunk_extern }

0 commit comments

Comments
 (0)