[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


================
@@ -327,6 +327,38 @@ InstructionCost VPSingleDefRecipe::computeCost(ElementCount VF,
   return UI ? Ctx.getLegacyCost(UI, VF) : 0;
 }
 
+void VPPartialReductionRecipe::execute(VPTransformState &State) {
+  State.setDebugLocFrom(getDebugLoc());
+  auto &Builder = State.Builder;
+
+  assert(Opcode == Instruction::Add && "Unhandled partial reduction opcode");
+
+  Value *BinOpVal = State.get(getOperand(0), 0);
----------------
huntergr-arm wrote:

I think you can remove the second operand to `State.get` here -- it used to be related to the Part for interleaving, but now relates to whether the Value you want should be scalar or not, and defaults to false.

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


More information about the llvm-commits mailing list