[llvm] [SLP] Fix canConvertToFMA operand selection and fmul costing (PR #216425)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 16 02:36:09 PDT 2026
================
@@ -13,12 +13,42 @@ define void @axpy4_contract(ptr noalias %d, ptr noalias %a, ptr noalias %b, ptr
; CHECK-LABEL: define void @axpy4_contract(
; CHECK-SAME: ptr noalias [[D:%.*]], ptr noalias [[A:%.*]], ptr noalias [[B:%.*]], ptr noalias [[C:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: [[ENTRY:.*:]]
-; CHECK-NEXT: [[TMP0:%.*]] = load <4 x float>, ptr [[C]], align 4
-; CHECK-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr [[A]], align 4
-; CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[B]], align 4
-; CHECK-NEXT: [[TMP3:%.*]] = fmul contract <4 x float> [[TMP1]], [[TMP2]]
-; CHECK-NEXT: [[TMP4:%.*]] = fadd contract <4 x float> [[TMP0]], [[TMP3]]
-; CHECK-NEXT: store <4 x float> [[TMP4]], ptr [[D]], align 4
+; CHECK-NEXT: [[C0:%.*]] = load float, ptr [[C]], align 4
----------------
MrSidims wrote:
We don't, the patch doesn't change what gets emitted at any real threshold. The tree cost moves from -16 to -14 because the fmul bundle is now marked combined, so its delta is no longer counted twice. At the default threshold both numbers still say vectorize, and the IR is byte-identical to before the patch.
The test only shows scalar because it pins -slp-threshold=14, which sits exactly on the moved flip point. That's the only place the change is observable, which is what makes it a decision test.
https://github.com/llvm/llvm-project/pull/216425
More information about the llvm-commits
mailing list