[llvm] [LV] Reuse VPReplicateRecipe to handle scalar stores in exit block. (PR #106342)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 01:15:28 PDT 2024


================
@@ -9183,9 +9162,13 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
       for (VPUser *U : Cur->users()) {
         auto *UserRecipe = cast<VPSingleDefRecipe>(U);
         if (!UserRecipe->getParent()->getEnclosingLoopRegion()) {
-          assert(match(U, m_Binary<VPInstruction::ExtractFromEnd>(
-                              m_VPValue(), m_VPValue())) &&
-                 "U must be an ExtractFromEnd VPInstruction");
+          assert((match(U, m_Binary<VPInstruction::ExtractFromEnd>(
+                               m_VPValue(), m_VPValue())) ||
+                  (isa<VPReplicateRecipe>(U) &&
+                   cast<VPReplicateRecipe>(U)->getUnderlyingValue() ==
+                       RdxDesc.IntermediateStore)) &&
+                 "U must be either an ExtractFromEnd VPInstruction or a "
+                 "uniform store sourced from the intermediate store.");
----------------
Mel-Chen wrote:

Agree. 
a3a6614c608013bea8c235c710139583fa9e8e8e

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


More information about the llvm-commits mailing list