[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:36 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) {
+ return all_of(I->users(), [Scale, this](const User *U) {
----------------
fhahn wrote:
Thanks, I had to move the lambda definition into the loop so we can capture scale, as to just pass the function to `all_of()` it needs to take a single `User*` argument I think
https://github.com/llvm/llvm-project/pull/162822
More information about the llvm-commits
mailing list