diff --git a/llvm/include/llvm/IR/Attributes.td b/llvm/include/llvm/IR/Attributes.td --- a/llvm/include/llvm/IR/Attributes.td +++ b/llvm/include/llvm/IR/Attributes.td @@ -233,6 +233,7 @@ 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 @@ def : MergeRule<"setAND">; def : MergeRule<"setAND">; def : MergeRule<"setAND">; +def : MergeRule<"setAND">; def : MergeRule<"setAND">; def : MergeRule<"setOR">; def : MergeRule<"setOR">; diff --git a/llvm/test/Transforms/Inline/attributes.ll b/llvm/test/Transforms/Inline/attributes.ll --- a/llvm/test/Transforms/Inline/attributes.ll +++ b/llvm/test/Transforms/Inline/attributes.ll @@ -440,9 +440,177 @@ ; 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" }