[PATCH] D74713: [ConstantFold] fold most FP ops with undef operand to undef rather than NaN
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 17 12:11:43 PST 2020
lebedev.ri added inline comments.
================
Comment at: llvm/test/Transforms/InstSimplify/fp-undef.ll:211-212
define float @fadd_undef_op0_nnan_constant(float %x) {
; CHECK-LABEL: @fadd_undef_op0_nnan_constant(
-; CHECK-NEXT: ret float 0x7FF8000000000000
+; CHECK-NEXT: ret float undef
;
----------------
This is correct
```
----------------------------------------
define float @fadd_undef_op0_nnan_constant(float %x) {
%0:
%r = fadd nnan float undef, 1.000000
ret float %r
}
=>
define float @fadd_undef_op0_nnan_constant(float %x) {
%0:
%r = fadd nnan float undef, 1.000000
ret float undef
}
Transformation seems to be correct!
Summary:
1 correct transformations
0 incorrect transformations
0 errors
```
================
Comment at: llvm/test/Transforms/InstSimplify/fp-undef.ll:218-224
define float @fadd_undef_op1_constant(float %x) {
; CHECK-LABEL: @fadd_undef_op1_constant(
-; CHECK-NEXT: ret float 0x7FF8000000000000
+; CHECK-NEXT: ret float undef
;
%r = fadd float 2.0, undef
ret float %r
}
----------------
This is not correct
```
----------------------------------------
define float @fadd_undef_op1_constant(float %x) {
%0:
%r = fadd float 2.000000, undef
ret float %r
}
=>
define float @fadd_undef_op1_constant(float %x) {
%0:
%r = fadd float 2.000000, undef
ret float undef
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
float %x = poison
Source:
float %r = NaN [based on undef value]
Target:
float %r = NaN [based on undef value]
Source value: NaN
Target value: #x84000400 (-0.000000000000?)
Summary:
0 correct transformations
1 incorrect transformations
0 errors
```
================
Comment at: llvm/test/Transforms/InstSimplify/fp-undef.ll:234-240
define float @fsub_undef_op1_constant(float %x) {
; CHECK-LABEL: @fsub_undef_op1_constant(
-; CHECK-NEXT: ret float 0x7FF8000000000000
+; CHECK-NEXT: ret float undef
;
%r = fsub float 4.0, undef
ret float %r
}
----------------
Again, no
```
----------------------------------------
define float @fsub_undef_op1_constant(float %x) {
%0:
%r = fsub float 4.000000, undef
ret float %r
}
=>
define float @fsub_undef_op1_constant(float %x) {
%0:
%r = fsub float 4.000000, undef
ret float undef
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
float %x = poison
Source:
float %r = NaN [based on undef value]
Target:
float %r = NaN [based on undef value]
Source value: NaN
Target value: #x84000400 (-0.000000000000?)
Summary:
0 correct transformations
1 incorrect transformations
0 errors
```
================
Comment at: llvm/test/Transforms/InstSimplify/fp-undef.ll:242-248
define float @fmul_undef_op0_nnan_constant(float %x) {
; CHECK-LABEL: @fmul_undef_op0_nnan_constant(
-; CHECK-NEXT: ret float 0x7FF8000000000000
+; CHECK-NEXT: ret float undef
;
%r = fmul nnan float undef, 5.0
ret float %r
}
----------------
This is correct
================
Comment at: llvm/test/Transforms/InstSimplify/fp-undef.ll:250-256
define float @fmul_undef_op1_constant(float %x) {
; CHECK-LABEL: @fmul_undef_op1_constant(
-; CHECK-NEXT: ret float 0x7FF8000000000000
+; CHECK-NEXT: ret float undef
;
%r = fmul float 6.0, undef
ret float %r
}
----------------
No
```
----------------------------------------
define float @fmul_undef_op1_constant(float %x) {
%0:
%r = fmul float 6.000000, undef
ret float %r
}
=>
define float @fmul_undef_op1_constant(float %x) {
%0:
%r = fmul float 6.000000, undef
ret float undef
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
float %x = poison
Source:
float %r = NaN [based on undef value]
Target:
float %r = NaN [based on undef value]
Source value: NaN
Target value: #x00001000 (0.000000000000?)
Summary:
0 correct transformations
1 incorrect transformations
0 errors
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74713/new/
https://reviews.llvm.org/D74713
More information about the llvm-commits
mailing list