[llvm] [LV] Check all users of partial reductions in chain have same scale. (PR #162822)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 06:23:35 PDT 2025


================
@@ -7910,6 +7910,29 @@ void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {
         (!Chain.ExtendB || ExtendIsOnlyUsedByPartialReductions(Chain.ExtendB)))
       ScaledReductionMap.try_emplace(Chain.Reduction, Pair.second);
   }
+
+  // Check that all partial reductions in a chain are only used by other partial
+  // reductions with the same scale factor. Otherwise we end up creating users
+  // of scaled reductions where the types of the other operands don't match.
+  auto AllUsersPartialRdx = [this](Instruction *I, unsigned Scale) {
----------------
fhahn wrote:

It does not have enough information unfortunately, as there are cases that will only get rejected below, .e.g `ExtendIsOnlyUsedByPartialReductions`

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


More information about the llvm-commits mailing list