[llvm] [LoopVectorizer] Allow partial reductions to be made in predicated loops (PR #124268)

James Chesterman via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 06:16:34 PST 2025


================
@@ -9876,8 +9871,9 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
           PhiTy->isFloatingPointTy()
               ? std::make_optional(RdxDesc.getFastMathFlags())
               : std::nullopt;
-      NewExitingVPV =
-          Builder.createSelect(Cond, OrigExitingVPV, PhiR, {}, "", FMFs);
+      if (!isa<VPPartialReductionRecipe>(OrigExitingVPV->getDefiningRecipe()))
----------------
JamesChesterman wrote:

Done, I've put it as an extra condition in the if statement above it. This is because everything within this if statement seems to replace `OrigExistingVPV` with `NewExistingVPV`, which is just `OrigExistingVPV` but with a `Select` instruction being performed on it.

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


More information about the llvm-commits mailing list