[llvm] [InstCombine] Fold fcmp ogt (x - y), 0 into fcmp ogt x, y #85245 (PR #85506)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 02:16:21 PDT 2024


================
@@ -1718,3 +1718,387 @@ define <2 x i1> @fcmp_une_sel_x_negx_with_any_fpzero_nnan_vec(<2 x i1> %cond, <2
   %icmp = fcmp nnan une <2 x float> %sel, <float 0.0, float -0.0>
   ret <2 x i1> %icmp
 }
+
+; negative test - extra use
+
+define i1 @fcmp_ueq_fsub_const_extra_use(float %x, float %y) {
+; CHECK-LABEL: @fcmp_ueq_fsub_const_extra_use(
+; CHECK-NEXT:    [[FS:%.*]] = fsub float [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    call void @use(float [[FS]])
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq float [[FS]], 0.000000e+00
+; CHECK-NEXT:    ret i1 [[CMP]]
+;
+  %fs = fsub float %x, %y
+  call void @use(float %fs)
+  %cmp = fcmp ueq float %fs, 0.000000e+00
----------------
arsenm wrote:

Is this failing for the right reason? Don't you need the known-not-inf case for the fsub? 

https://github.com/llvm/llvm-project/pull/85506


More information about the llvm-commits mailing list