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

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 05:44:54 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()))
----------------
MacDue wrote:

I'm wonder if this check could be moved a bit earlier? Looking above the `Cond` and `FMFs` it is creating are unused if `NewExitingVPV` is not set. 

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


More information about the llvm-commits mailing list