[llvm] [LV] Don't create partial reductions if factor doesn't match accumulator (PR #158603)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 16 07:36:27 PDT 2025
================
@@ -8141,8 +8141,11 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(VPSingleDefRecipe *R,
if (isa<LoadInst>(Instr) || isa<StoreInst>(Instr))
return tryToWidenMemory(Instr, Operands, Range);
- if (std::optional<unsigned> ScaleFactor = getScalingForReduction(Instr))
- return tryToCreatePartialReduction(Instr, Operands, ScaleFactor.value());
+ if (std::optional<unsigned> ScaleFactor = getScalingForReduction(Instr)) {
+ if (auto PartialRed =
+ tryToCreatePartialReduction(Instr, Operands, ScaleFactor.value()))
+ return PartialRed;
+ }
----------------
fhahn wrote:
Yes, we need to account for `tryToCreatePartialReduction` now possibly returning `nullptr`
https://github.com/llvm/llvm-project/pull/158603
More information about the llvm-commits
mailing list