[llvm] [LV] Vectorize selecting last IV of min/max element. (PR #141431)

via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 22 03:54:01 PST 2025


================
@@ -7994,8 +7999,8 @@ void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {
             SmallVector<std::pair<PartialReductionChain, unsigned>>>
       ChainsByPhi;
   for (const auto &[Phi, RdxDesc] : Legal->getReductionVars())
-    getScaledReductions(Phi, RdxDesc.getLoopExitInstr(), Range,
-                        ChainsByPhi[Phi]);
+    if (Instruction *RdxExitInstr = RdxDesc.getLoopExitInstr())
+      getScaledReductions(Phi, RdxExitInstr, Range, ChainsByPhi[Phi]);
----------------
ayalz wrote:

nit: may be good to wrap loop body in brackets.

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


More information about the llvm-commits mailing list