[llvm] [LoopVectorize][NFC] Simplify ScaledReductionExitInstrs map (PR #123368)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 05:34:08 PST 2025


================
@@ -8803,9 +8803,9 @@ VPRecipeBuilder::tryToCreateWidenRecipe(Instruction *Instr,
              Phi->getIncomingValueForBlock(OrigLoop->getLoopPreheader()));
 
       // If the PHI is used by a partial reduction, set the scale factor.
-      std::optional<std::pair<PartialReductionChain, unsigned>> Pair =
-          getScaledReductionForInstr(RdxDesc.getLoopExitInstr());
-      unsigned ScaleFactor = Pair ? Pair->second : 1;
+      std::optional<unsigned> Scale =
+          getScalingForReduction(RdxDesc.getLoopExitInstr());
+      unsigned ScaleFactor = Scale.value_or(1);
----------------
fhahn wrote:

nit: could also be folded into a single line setting `unsigned ScaleFactor` directly.

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


More information about the llvm-commits mailing list