<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60913>60913</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[GVN] Accidentally remove strictfp function.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
HanKuanChen
</td>
</tr>
</table>
<pre>
The second `@test_sub` should not be eliminated. The result of `@test_sub` is affected by rounding mode.
```
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=gvn < %s | FileCheck %s
; Function Attrs: strictfp memory(none)
define <2 x float> @test_sub(<2 x float> %var_1) #0 {
; CHECK-LABEL: @test_sub(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[SUB_I:%.*]] = tail call <2 x float> @llvm.experimental.constrained.fsub.v2f32(<2 x float> zeroinitializer, <2 x float> [[VAR_1:%.*]], metadata !"round.tonearest", metadata !"fpexcept.ignore") #[[ATTR1:[0-9]+]]
; CHECK-NEXT: ret <2 x float> [[SUB_I]]
;
entry:
%sub.i = tail call <2 x float> @llvm.experimental.constrained.fsub.v2f32(<2 x float> zeroinitializer, <2 x float> %var_1, metadata !"round.tonearest", metadata !"fpexcept.ignore") #1
ret <2 x float> %sub.i
}
; Function Attrs: strictfp
define void @test(ptr %var_5) #1 {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CALL12:%.*]] = tail call <2 x float> @test_sub(<2 x float> <float 0x7FF8000000000000, float 0.000000e+00>)
; CHECK-NEXT: store <2 x float> <float 0x7FF8000000000000, float 0.000000e+00>, ptr [[VAR_5:%.*]], align 4
; CHECK-NEXT: [[CALL_1:%.*]] = tail call i32 @fesetround(i32 2) #[[ATTR1]]
; CHECK-NEXT: [[ADD_PTR_1:%.*]] = getelementptr float, ptr [[VAR_5]], i64 2
; CHECK-NEXT: store <2 x float> [[CALL12]], ptr [[ADD_PTR_1]], align 4
; CHECK-NEXT: ret void
;
entry:
%call12 = tail call <2 x float> @test_sub(<2 x float> <float 0x7FF8000000000000, float 0.000000e+00>)
store <2 x float> <float 0x7FF8000000000000, float 0.000000e+00>, ptr %var_5, align 4
%call.1 = tail call i32 @fesetround(i32 2) #1
%call12.1 = tail call <2 x float> @test_sub(<2 x float> <float 0x7FF8000000000000, float 0.000000e+00>)
%add.ptr.1 = getelementptr float, ptr %var_5, i64 2
store <2 x float> %call12.1, ptr %add.ptr.1, align 4
ret void
}
declare i32 @fesetround(i32)
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite)
declare <2 x float> @llvm.experimental.constrained.fsub.v2f32(<2 x float>, <2 x float>, metadata, metadata) #2
attributes #0 = { strictfp memory(none) }
attributes #1 = { strictfp }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEV9tu2zgQ_Rr6ZRBBIi1fHvzg63bRILto3WLfDEoa2dzSpEBSTtyvX5BWfIucbRbpNghsWZrLmaMzQ5JbK9YKcUTSCUlnHV67jTajD1x9rLmablB1Ml3sR8sNgsVcqwJILybd2KF1K1tnpBeD3ehaFqC0gwwBpdgKxR0WEXg3g7aWDnTZ4iks8LLE3GEB2R6MrlUh1Bq2usCIxDMSj5vPXtz8H36yCTz8sZwTNoaxtWic0MrChu8QMkQFvHZ6jQoNb0LXTkhL6KKuCu5wFUDkG8y_2ajan4J--vLgY-rKwd1nuKu4tWgJm613CgibAqGpBdKfwkJInHr_cOsCKpvAola5hwRj54z1Ea0zIndlBVvcarMndKC0QkKHB6cCS6HQp6DwBKXU3BE2h3O66ODFU5ruuFklhA6BUBYD6U9OGKYf5tOPd_fjyfzeA7gKdWX2MP9r6a0AlTN7wsY3DQCCVCafv0xWv3tDmkaEjkk6I-kMCJuB40JCzqVsK0fK3TbCpwqN2KJyXEa5VtYZLhQWUWn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