[PATCH] D104533: [LoopVectorize] Fix strict reductions where VF = 1

Kerry McLaughlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 18 09:47:56 PDT 2021


kmclaughlin added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9266
   // Adjust the recipes for any inloop reductions.
-  if (Range.Start.isVector())
-    adjustRecipesForInLoopReductions(Plan, RecipeBuilder);
+  adjustRecipesForInLoopReductions(Plan, RecipeBuilder, Range.Start);
 
----------------
sdesmalen wrote:
> Is this a valid change for in-loop reductions that are not in-order? Or does this now break things for VF=1, UF>1 for in-loop reductions?
Hi @sdesmalen, thanks for pointing this out, this will break things for in-loop reductions where VF=1 & UF>1. I've changed adjustRecipesForInLoopReductions so that we only add a VPReductionRecipe where VF.isScalar if useOrderedReductions is also true.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9386
             RecipeBuilder.getRecipe(cast<Instruction>(R->getOperand(0)));
         assert(isa<VPWidenRecipe>(CompareRecipe) &&
                "Expected to replace a VPWidenSC");
----------------
sdesmalen wrote:
> Should these asserts be guarded as well?
These asserts are only for only for min/max recurrences, so we should never reach these for ordered reductions.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104533/new/

https://reviews.llvm.org/D104533



More information about the llvm-commits mailing list