Skip to content

Commit dab8fb8

Browse files
authored
[Instrumentation] Remove unsafe-fp-math attribute support (#164533)
Now codegen part no longer depends on this attribute, remove it.
1 parent d6b6854 commit dab8fb8

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,6 @@ static void moveFastMathFlags(Function &F,
20202020
F.removeFnAttr(attr); \
20212021
FMF.set##setter(); \
20222022
}
2023-
MOVE_FLAG("unsafe-fp-math", Fast)
20242023
MOVE_FLAG("no-infs-fp-math", NoInfs)
20252024
MOVE_FLAG("no-nans-fp-math", NoNaNs)
20262025
MOVE_FLAG("no-signed-zeros-fp-math", NoSignedZeros)

llvm/test/Instrumentation/NumericalStabilitySanitizer/basic.ll

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -865,33 +865,6 @@ entry:
865865
ret float %r
866866
}
867867

868-
; Note that the `unsafe-fp-math` from the function attributes should be moved to
869-
; individual instructions, with the shadow instructions NOT getting the attribute.
870-
define float @param_add_return_float_unsafe_fp_math(float %a) #0 {
871-
; CHECK-LABEL: @param_add_return_float_unsafe_fp_math(
872-
; CHECK-NEXT: entry:
873-
; CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__nsan_shadow_args_tag, align 8
874-
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i64 [[TMP0]], ptrtoint (ptr @param_add_return_float_unsafe_fp_math to i64)
875-
; CHECK-NEXT: [[TMP2:%.*]] = load double, ptr @__nsan_shadow_args_ptr, align 1
876-
; CHECK-NEXT: [[TMP3:%.*]] = fpext float [[A:%.*]] to double
877-
; CHECK-NEXT: [[TMP4:%.*]] = select i1 [[TMP1]], double [[TMP2]], double [[TMP3]]
878-
; CHECK-NEXT: store i64 0, ptr @__nsan_shadow_args_tag, align 8
879-
; CHECK-NEXT: [[B:%.*]] = fadd fast float [[A]], 1.000000e+00
880-
; CHECK-NEXT: [[TMP5:%.*]] = fadd double [[TMP4]], 1.000000e+00
881-
; CHECK-NEXT: [[TMP6:%.*]] = call i32 @__nsan_internal_check_float_d(float [[B]], double [[TMP5]], i32 1, i64 0)
882-
; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i32 [[TMP6]], 1
883-
; CHECK-NEXT: [[TMP8:%.*]] = fpext float [[B]] to double
884-
; CHECK-NEXT: [[TMP9:%.*]] = select i1 [[TMP7]], double [[TMP8]], double [[TMP5]]
885-
; CHECK-NEXT: store i64 ptrtoint (ptr @param_add_return_float_unsafe_fp_math to i64), ptr @__nsan_shadow_ret_tag, align 8
886-
; CHECK-NEXT: store double [[TMP9]], ptr @__nsan_shadow_ret_ptr, align 8
887-
; CHECK-NEXT: ret float [[B]]
888-
;
889-
entry:
890-
%b = fadd float %a, 1.0
891-
ret float %b
892-
}
893-
894-
895868
define void @truncate(<2 x double> %0) sanitize_numerical_stability {
896869
; DQQ-LABEL: @truncate(
897870
; DQQ-NEXT: entry:
@@ -941,4 +914,4 @@ entry:
941914
}
942915

943916

944-
attributes #0 = { nounwind readonly uwtable sanitize_numerical_stability "correctly-rounded-divide-sqrt-fp-math"="false" "denormal-fp-math"="preserve-sign,preserve-sign" "denormal-fp-math-f32"="ieee,ieee" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-jump-tables"="false" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="true" "use-soft-float"="false" }
917+
attributes #0 = { nounwind readonly uwtable sanitize_numerical_stability "correctly-rounded-divide-sqrt-fp-math"="false" "denormal-fp-math"="preserve-sign,preserve-sign" "denormal-fp-math-f32"="ieee,ieee" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-jump-tables"="false" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }

0 commit comments

Comments
 (0)