[llvm] [LV] Ensure getScaledReductions only matches extends inside the loop (PR #148264)

Matthew Devereau via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 06:33:36 PDT 2025


================
@@ -8112,14 +8112,19 @@ bool VPRecipeBuilder::getScaledReductions(
   std::optional<unsigned> BinOpc;
   Type *ExtOpTypes[2] = {nullptr};
 
-  auto CollectExtInfo = [&Exts,
+  auto CollectExtInfo = [this, &Exts,
                          &ExtOpTypes](SmallVectorImpl<Value *> &Ops) -> bool {
     unsigned I = 0;
     for (Value *OpI : Ops) {
       Value *ExtOp;
       if (!match(OpI, m_ZExtOrSExt(m_Value(ExtOp))))
         return false;
       Exts[I] = cast<Instruction>(OpI);
+
+      // Other operand should live inside the loop
----------------
MDevereau wrote:

Unnecessary comment which says the same as the code below it. I'd remove it or be more specific about why it's here.

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


More information about the llvm-commits mailing list