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

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 06:39:24 PDT 2024


================
@@ -233,6 +233,11 @@ Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPReplicateRecipe *R) {
   llvm_unreachable("Unhandled opcode");
 }
 
+Type *
+VPTypeAnalysis::inferScalarTypeForRecipe(const VPPartialReductionRecipe *R) {
+  return R->getUnderlyingInstr()->getType();
----------------
huntergr-arm wrote:

I think it would just be moving `VPPartialReductionRecipe` into the `.Case` statement above the current one (alongside `VPReductionRecipe`) in the base `inferScalarType(const VPValue *)`, which will recursively infer the scalar type based on the first operand. Then you wouldn't need this extra method.

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


More information about the llvm-commits mailing list