forked from OSchip/llvm-project
[Inliner] Handle 'no-signed-zeros-fp-math' function attribute.
All other floating point math optimization related attribute are merged in a conservative way during function inlining. This commit adds the merge rule for the 'no-signed-zeros-fp-math' attribute. Differential Revision: https://reviews.llvm.org/D81714
This commit is contained in:
parent
06412dae82
commit
413a187856
|
@ -233,6 +233,7 @@ def ZExt : EnumAttr<"zeroext">;
|
|||
def LessPreciseFPMAD : StrBoolAttr<"less-precise-fpmad">;
|
||||
def NoInfsFPMath : StrBoolAttr<"no-infs-fp-math">;
|
||||
def NoNansFPMath : StrBoolAttr<"no-nans-fp-math">;
|
||||
def NoSignedZerosFPMath : StrBoolAttr<"no-signed-zeros-fp-math">;
|
||||
def UnsafeFPMath : StrBoolAttr<"unsafe-fp-math">;
|
||||
def NoJumpTables : StrBoolAttr<"no-jump-tables">;
|
||||
def NoInlineLineTables : StrBoolAttr<"no-inline-line-tables">;
|
||||
|
@ -270,6 +271,7 @@ class MergeRule<string F> {
|
|||
def : MergeRule<"setAND<LessPreciseFPMADAttr>">;
|
||||
def : MergeRule<"setAND<NoInfsFPMathAttr>">;
|
||||
def : MergeRule<"setAND<NoNansFPMathAttr>">;
|
||||
def : MergeRule<"setAND<NoSignedZerosFPMathAttr>">;
|
||||
def : MergeRule<"setAND<UnsafeFPMathAttr>">;
|
||||
def : MergeRule<"setOR<NoImplicitFloatAttr>">;
|
||||
def : MergeRule<"setOR<NoJumpTablesAttr>">;
|
||||
|
|
|
@ -440,9 +440,177 @@ define i32 @test_null-pointer-is-valid2(i32 %i) null_pointer_is_valid {
|
|||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @no-infs-fp-math_callee0(i32 %i) "no-infs-fp-math"="false" {
|
||||
ret i32 %i
|
||||
; CHECK: @no-infs-fp-math_callee0(i32 %i) [[NO_INFS_FPMATH_FALSE:#[0-9]+]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @no-infs-fp-math_callee1(i32 %i) "no-infs-fp-math"="true" {
|
||||
ret i32 %i
|
||||
; CHECK: @no-infs-fp-math_callee1(i32 %i) [[NO_INFS_FPMATH_TRUE:#[0-9]+]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-infs-fp-math0(i32 %i) "no-infs-fp-math"="false" {
|
||||
%1 = call i32 @no-infs-fp-math_callee0(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-infs-fp-math0(i32 %i) [[NO_INFS_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-infs-fp-math1(i32 %i) "no-infs-fp-math"="false" {
|
||||
%1 = call i32 @no-infs-fp-math_callee1(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-infs-fp-math1(i32 %i) [[NO_INFS_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-infs-fp-math2(i32 %i) "no-infs-fp-math"="true" {
|
||||
%1 = call i32 @no-infs-fp-math_callee0(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-infs-fp-math2(i32 %i) [[NO_INFS_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-infs-fp-math3(i32 %i) "no-infs-fp-math"="true" {
|
||||
%1 = call i32 @no-infs-fp-math_callee1(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-infs-fp-math3(i32 %i) [[NO_INFS_FPMATH_TRUE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @no-nans-fp-math_callee0(i32 %i) "no-nans-fp-math"="false" {
|
||||
ret i32 %i
|
||||
; CHECK: @no-nans-fp-math_callee0(i32 %i) [[NO_NANS_FPMATH_FALSE:#[0-9]+]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @no-nans-fp-math_callee1(i32 %i) "no-nans-fp-math"="true" {
|
||||
ret i32 %i
|
||||
; CHECK: @no-nans-fp-math_callee1(i32 %i) [[NO_NANS_FPMATH_TRUE:#[0-9]+]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-nans-fp-math0(i32 %i) "no-nans-fp-math"="false" {
|
||||
%1 = call i32 @no-nans-fp-math_callee0(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-nans-fp-math0(i32 %i) [[NO_NANS_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-nans-fp-math1(i32 %i) "no-nans-fp-math"="false" {
|
||||
%1 = call i32 @no-nans-fp-math_callee1(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-nans-fp-math1(i32 %i) [[NO_NANS_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-nans-fp-math2(i32 %i) "no-nans-fp-math"="true" {
|
||||
%1 = call i32 @no-nans-fp-math_callee0(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-nans-fp-math2(i32 %i) [[NO_NANS_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-nans-fp-math3(i32 %i) "no-nans-fp-math"="true" {
|
||||
%1 = call i32 @no-nans-fp-math_callee1(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-nans-fp-math3(i32 %i) [[NO_NANS_FPMATH_TRUE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @no-signed-zeros-fp-math_callee0(i32 %i) "no-signed-zeros-fp-math"="false" {
|
||||
ret i32 %i
|
||||
; CHECK: @no-signed-zeros-fp-math_callee0(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_FALSE:#[0-9]+]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @no-signed-zeros-fp-math_callee1(i32 %i) "no-signed-zeros-fp-math"="true" {
|
||||
ret i32 %i
|
||||
; CHECK: @no-signed-zeros-fp-math_callee1(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_TRUE:#[0-9]+]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-signed-zeros-fp-math0(i32 %i) "no-signed-zeros-fp-math"="false" {
|
||||
%1 = call i32 @no-signed-zeros-fp-math_callee0(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-signed-zeros-fp-math0(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-signed-zeros-fp-math1(i32 %i) "no-signed-zeros-fp-math"="false" {
|
||||
%1 = call i32 @no-signed-zeros-fp-math_callee1(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-signed-zeros-fp-math1(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-signed-zeros-fp-math2(i32 %i) "no-signed-zeros-fp-math"="true" {
|
||||
%1 = call i32 @no-signed-zeros-fp-math_callee0(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-signed-zeros-fp-math2(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_no-signed-zeros-fp-math3(i32 %i) "no-signed-zeros-fp-math"="true" {
|
||||
%1 = call i32 @no-signed-zeros-fp-math_callee1(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_no-signed-zeros-fp-math3(i32 %i) [[NO_SIGNED_ZEROS_FPMATH_TRUE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @unsafe-fp-math_callee0(i32 %i) "unsafe-fp-math"="false" {
|
||||
ret i32 %i
|
||||
; CHECK: @unsafe-fp-math_callee0(i32 %i) [[UNSAFE_FPMATH_FALSE:#[0-9]+]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @unsafe-fp-math_callee1(i32 %i) "unsafe-fp-math"="true" {
|
||||
ret i32 %i
|
||||
; CHECK: @unsafe-fp-math_callee1(i32 %i) [[UNSAFE_FPMATH_TRUE:#[0-9]+]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_unsafe-fp-math0(i32 %i) "unsafe-fp-math"="false" {
|
||||
%1 = call i32 @unsafe-fp-math_callee0(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_unsafe-fp-math0(i32 %i) [[UNSAFE_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_unsafe-fp-math1(i32 %i) "unsafe-fp-math"="false" {
|
||||
%1 = call i32 @unsafe-fp-math_callee1(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_unsafe-fp-math1(i32 %i) [[UNSAFE_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_unsafe-fp-math2(i32 %i) "unsafe-fp-math"="true" {
|
||||
%1 = call i32 @unsafe-fp-math_callee0(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_unsafe-fp-math2(i32 %i) [[UNSAFE_FPMATH_FALSE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
define i32 @test_unsafe-fp-math3(i32 %i) "unsafe-fp-math"="true" {
|
||||
%1 = call i32 @unsafe-fp-math_callee1(i32 %i)
|
||||
ret i32 %1
|
||||
; CHECK: @test_unsafe-fp-math3(i32 %i) [[UNSAFE_FPMATH_TRUE]] {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
; CHECK: attributes [[SLH]] = { speculative_load_hardening }
|
||||
; CHECK: attributes [[FPMAD_FALSE]] = { "less-precise-fpmad"="false" }
|
||||
; CHECK: attributes [[FPMAD_TRUE]] = { "less-precise-fpmad"="true" }
|
||||
; CHECK: attributes [[NOIMPLICITFLOAT]] = { noimplicitfloat }
|
||||
; CHECK: attributes [[NOUSEJUMPTABLES]] = { "no-jump-tables"="true" }
|
||||
; CHECK: attributes [[NULLPOINTERISVALID]] = { null_pointer_is_valid }
|
||||
; CHECK: attributes [[NO_INFS_FPMATH_FALSE]] = { "no-infs-fp-math"="false" }
|
||||
; CHECK: attributes [[NO_INFS_FPMATH_TRUE]] = { "no-infs-fp-math"="true" }
|
||||
; CHECK: attributes [[NO_NANS_FPMATH_FALSE]] = { "no-nans-fp-math"="false" }
|
||||
; CHECK: attributes [[NO_NANS_FPMATH_TRUE]] = { "no-nans-fp-math"="true" }
|
||||
; CHECK: attributes [[NO_SIGNED_ZEROS_FPMATH_FALSE]] = { "no-signed-zeros-fp-math"="false" }
|
||||
; CHECK: attributes [[NO_SIGNED_ZEROS_FPMATH_TRUE]] = { "no-signed-zeros-fp-math"="true" }
|
||||
; CHECK: attributes [[UNSAFE_FPMATH_FALSE]] = { "unsafe-fp-math"="false" }
|
||||
; CHECK: attributes [[UNSAFE_FPMATH_TRUE]] = { "unsafe-fp-math"="true" }
|
||||
|
|
Loading…
Reference in New Issue