[llvm] [AArch64][LV] Reduce cost of scaled reduction extends (PR #134074)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 3 05:42:52 PDT 2025
================
@@ -1693,6 +1693,15 @@ InstructionCost VPWidenRecipe::computeCost(ElementCount VF,
if (RHS->isLiveIn())
RHSInfo = Ctx.TTI.getOperandInfo(RHS->getLiveInIRValue());
+ // The mul is folded into another target instruction when participating
+ // in scaled reductions.
+ if (Opcode == Instruction::Mul && !hasMoreThanOneUniqueUser()) {
+ if (all_of(users(), [](const VPUser *U) {
+ return isa_and_present<VPPartialReductionRecipe>(U);
+ }))
+ return TTI::TCC_Free;
----------------
david-arm wrote:
See my comment on `isScaledReductionExtension` - I have concerns this is essentially AArch64-specific code being used for all targets.
https://github.com/llvm/llvm-project/pull/134074
More information about the llvm-commits
mailing list