[PATCH] D74713: [ConstantFold] fold most FP ops with undef operand to undef rather than NaN
Nuno Lopes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 17 14:36:22 PST 2020
nlopes added inline comments.
================
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
}
----------------
spatel wrote:
> lebedev.ri wrote:
> > 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
> >
> > ```
> Apologies for not having recent Alive installed anywhere at the moment to test this myself, but how should we interpret this output?
>
> Is it saying that there is no value that we can assign to the undef operand that will produce the exact 0x84000400 output value?
Exactly!
"2.0 + x" can never be -1.5048164E-36 (0x84000400) for any x.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74713/new/
https://reviews.llvm.org/D74713
More information about the llvm-commits
mailing list