[llvm] b65f3aa - [InstCombine] add test for fcmp+select miscompile; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 12:39:53 PDT 2022


Author: Sanjay Patel
Date: 2022-08-25T15:38:19-04:00
New Revision: b65f3aa7d94ed63c7c97ace42eefeb5018f6c532

URL: https://github.com/llvm/llvm-project/commit/b65f3aa7d94ed63c7c97ace42eefeb5018f6c532
DIFF: https://github.com/llvm/llvm-project/commit/b65f3aa7d94ed63c7c97ace42eefeb5018f6c532.diff

LOG: [InstCombine] add test for fcmp+select miscompile; NFC

issue #57357

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/minmax-fp.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/minmax-fp.ll b/llvm/test/Transforms/InstCombine/minmax-fp.ll
index a0f09314a47ce..e687c8f073a6e 100644
--- a/llvm/test/Transforms/InstCombine/minmax-fp.ll
+++ b/llvm/test/Transforms/InstCombine/minmax-fp.ll
@@ -57,6 +57,19 @@ define double @t5(float %a) {
   ret double %3
 }
 
+; FIXME: This is a miscompile. PR57357
+
+define float @not_maxnum(float %x) {
+; CHECK-LABEL: @not_maxnum(
+; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp ole float [[X:%.*]], 0.000000e+00
+; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[DOTINV]], float -0.000000e+00, float [[X]]
+; CHECK-NEXT:    ret float [[TMP1]]
+;
+  %cmp = fcmp olt float %x, 0.0
+  %sel = select i1 %cmp, float -0.0, float %x
+  ret float %sel
+}
+
 ; From IEEE754: "Comparisons shall ignore the sign of zero (so +0 = -0)."
 ; So the compare constant may be treated as +0.0, and we sink the fpext.
 


        


More information about the llvm-commits mailing list