[llvm] [InstCombine] Remove some of the complexity-based canonicalization (PR #91185)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 07:39:01 PDT 2024


================
@@ -549,8 +549,9 @@ define float @test16_reassoc(float %a, float %b, float %z) {
 
 define float @test17(float %a, float %b, float %z) {
 ; CHECK-LABEL: @test17(
-; CHECK-NEXT:    [[TMP1:%.*]] = fmul fast float [[Z:%.*]], 4.000000e+01
-; CHECK-NEXT:    [[F:%.*]] = fmul fast float [[TMP1]], [[A:%.*]]
+; CHECK-NEXT:    [[C:%.*]] = fmul fast float [[Z:%.*]], -4.000000e+01
+; CHECK-NEXT:    [[TMP1:%.*]] = fneg fast float [[A:%.*]]
+; CHECK-NEXT:    [[F:%.*]] = fmul fast float [[C]], [[TMP1]]
----------------
nikic wrote:

I've "fixed" this as part of this PR by pushing into the other operand. We now reliably canonicalize fneg to the RHS, so using that operand should be more profitable. The correct fix is to invert the transform though.

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


More information about the llvm-commits mailing list