[llvm] [VPlan] Introduce ComputeReductionResult VPInstruction opcode. (PR #70253)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 1 13:39:33 PST 2024
================
@@ -9013,15 +8862,26 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
for (VPRecipeBase *R : ReductionPHIList)
R->moveBefore(*Header, Header->getFirstNonPhi());
- SmallVector<VPReductionPHIRecipe *> InLoopReductionPhis;
for (VPRecipeBase &R : Header->phis()) {
auto *PhiR = dyn_cast<VPReductionPHIRecipe>(&R);
- if (!PhiR || !PhiR->isInLoop() || (MinVF.isScalar() && !PhiR->isOrdered()))
+ if (!PhiR)
+ continue;
+
+ // TODO: At the moment ComputeReductionResult also creates the bc.merge.rdx
+ // phi nodes, hence it needs to be created unconditionally here, until the
+ // reduction resume value handling is also modeled in VPlan.
----------------
fhahn wrote:
Creation of `bc.merge.rdx` has been moved as suggested.
> How do we prevent ComputeReductionResult from being treated as dead code, if-not/until hooked-up to a LiveOut.
At the moment, `ComputeReductionResult` needs to be considered as having side effects to prevent DCE.
https://github.com/llvm/llvm-project/pull/70253
More information about the llvm-commits
mailing list