- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
[IR] Remove unsafe-fp-math attribute support #164534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
                
     Merged
            
            
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    6c6bd47    to
    ad383d2      
    Compare
  
    | @llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-llvm-ir Author: None (paperchalice) ChangesNow this attribute is no longer recognized by backends, remove it. Full diff: https://github.com/llvm/llvm-project/pull/164534.diff 3 Files Affected: 
 diff --git a/llvm/include/llvm/IR/Attributes.td b/llvm/include/llvm/IR/Attributes.td
index 8e7d9dcebfe2a..8ce2b1bea8fac 100644
--- a/llvm/include/llvm/IR/Attributes.td
+++ b/llvm/include/llvm/IR/Attributes.td
@@ -410,7 +410,6 @@ 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">;
 def ProfileSampleAccurate : StrBoolAttr<"profile-sample-accurate">;
@@ -474,7 +473,6 @@ 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>">;
 def : MergeRule<"setOR<ProfileSampleAccurateAttr>">;
diff --git a/llvm/test/Transforms/IROutliner/outlining-compatible-and-attribute-transfer.ll b/llvm/test/Transforms/IROutliner/outlining-compatible-and-attribute-transfer.ll
index b3f2e8102fc1e..15ce3e3c440fe 100644
--- a/llvm/test/Transforms/IROutliner/outlining-compatible-and-attribute-transfer.ll
+++ b/llvm/test/Transforms/IROutliner/outlining-compatible-and-attribute-transfer.ll
@@ -5,7 +5,7 @@
 ; attributes that should be transferred only if it is on all of the regions.
 
 ; This includes the attributes, no-nans-fp-math,
-; no-signed-zeros-fp-math, less-precise-fpmad, unsafe-fp-math, and
+; no-signed-zeros-fp-math, less-precise-fpmad, and
 ; no-infs-fp-math.  Only when each instance of similarity has these attributes
 ; can we say that the outlined function can have these attributes since that
 ; is the more general case for these attributes.
@@ -101,7 +101,7 @@ entry:
 }
 
 attributes #0 = { "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "less-precise-fpmad"="true"
-"unsafe-fp-math"="true" "no-infs-fp-math"="true"}
+"no-infs-fp-math"="true"}
 
 ; CHECK: define internal void @outlined_ir_func_0(ptr [[ARG0:%.*]], ptr [[ARG1:%.*]], ptr [[ARG2:%.*]]) [[ATTR1:#[0-9]+]] {
 ; CHECK: entry_to_outline:
@@ -122,5 +122,5 @@ attributes #0 = { "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "les
 ; CHECK-NEXT:    [[CL:%.*]] = load i32, ptr [[ARG2]], align 4
 
 
-; 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" }
-; 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" }
+; 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" }
+; 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" }
diff --git a/llvm/test/Transforms/Inline/attributes.ll b/llvm/test/Transforms/Inline/attributes.ll
index 55ab430f201d6..da7eeda543c79 100644
--- a/llvm/test/Transforms/Inline/attributes.ll
+++ b/llvm/test/Transforms/Inline/attributes.ll
@@ -601,46 +601,6 @@ define i32 @test_no-signed-zeros-fp-math3(i32 %i) "no-signed-zeros-fp-math"="tru
 ; 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
-}
-
 ; Test that fn_ret_thunk_extern has no CompatRule; inlining is permitted.
 ; Test that fn_ret_thunk_extern has no MergeRule; fn_ret_thunk_extern is not
 ; propagated or dropped on the caller after inlining.
@@ -693,6 +653,4 @@ define i32 @loader_replaceable_caller() {
 ; 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" }
 ; CHECK: attributes [[FNRETTHUNK_EXTERN]] = { fn_ret_thunk_extern }
 | 
              
                    arsenm
  
              
              approved these changes
              
                  
                    Oct 22, 2025 
                  
              
              
            
            
| Nice! | 
  This was referenced Oct 22, 2025 
      
    
  paperchalice 
      added a commit
      that referenced
      this pull request
    
      Oct 22, 2025 
    
    
      
  
    
      
    
  
Post cleanup for #164534.
    
  paperchalice 
      added a commit
      that referenced
      this pull request
    
      Oct 23, 2025 
    
    
      
  
    
      
    
  
Post cleanup for #164534.
    
  paperchalice 
      added a commit
      that referenced
      this pull request
    
      Oct 23, 2025 
    
    
      
  
    
      
    
  
Post cleanup for #164534.
    
  paperchalice 
      added a commit
        to paperchalice/llvm-project
      that referenced
      this pull request
    
      Oct 23, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  paperchalice 
      added a commit
        to paperchalice/llvm-project
      that referenced
      this pull request
    
      Oct 23, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
  This was referenced Oct 23, 2025 
      
    
  paperchalice 
      added a commit
        to paperchalice/llvm-project
      that referenced
      this pull request
    
      Oct 23, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  paperchalice 
      added a commit
      that referenced
      this pull request
    
      Oct 23, 2025 
    
    
  
    
  paperchalice 
      added a commit
      that referenced
      this pull request
    
      Oct 23, 2025 
    
    
      
  
    
      
    
  
Post cleanup for #164534.
    
  paperchalice 
      added a commit
      that referenced
      this pull request
    
      Oct 23, 2025 
    
    
      
  
    
      
    
  
Post cleanup for #164534.
    
  paperchalice 
      added a commit
        to paperchalice/llvm-project
      that referenced
      this pull request
    
      Oct 23, 2025 
    
    
  
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
      
  
    
      
    
  
Now this attribute is no longer recognized by backends, remove it.
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
  
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
  
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
  
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
  
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
  
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534. Also pick suggestion by nikic, remove redundant attributes.
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  Lukacma 
      pushed a commit
        to Lukacma/llvm-project
      that referenced
      this pull request
    
      Oct 29, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534. Not all attributes are stripped, some of them may affect debug info.
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
      
  
    
      
    
  
Now this attribute is no longer recognized by backends, remove it.
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
  
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
  
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
  
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
  
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
  
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534. Also pick suggestion by nikic, remove redundant attributes.
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534.
    
  aokblast 
      pushed a commit
        to aokblast/llvm-project
      that referenced
      this pull request
    
      Oct 30, 2025 
    
    
      
  
    
      
    
  
Post cleanup for llvm#164534. Not all attributes are stripped, some of them may affect debug info.
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Now this attribute is no longer recognized by backends, remove it.