[llvm] [LoopVectorizer] Add support for partial reductions (PR #92418)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 04:27:04 PDT 2024


================
@@ -437,6 +469,15 @@ Value *VPInstruction::generate(VPTransformState &State) {
     Value *Cond = State.get(getOperand(0));
     Value *Op1 = State.get(getOperand(1));
     Value *Op2 = State.get(getOperand(2));
+    auto *CondVec = dyn_cast<VectorType>(Cond->getType());
----------------
huntergr-arm wrote:

This feels fragile. Perhaps better to change the place where the select is introduced (`LoopVectorizationPlanner::adjustRecipesForReductions`) if it's a partial reduction? I guess that may mean we need to store details of partial reductions in `LoopVectorizationPlanner` and pass those to `VPRecipeBuilder` in the constructor.

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


More information about the llvm-commits mailing list