[llvm] [InstCombine] Remove some of the complexity-based canonicalization (PR #91185)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 23:26:15 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 think this is related to this weird transform: https://github.com/llvm/llvm-project/blob/97be79ca126c1a0e174fdbc345a28868edc7cdc7/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp#L2685 It pushes the fneg into one of the operands, so it's fundamentally asymmetric. I believe for integers we perform the transform the other way around, such that it is symmetric.
https://github.com/llvm/llvm-project/pull/91185
More information about the llvm-commits
mailing list