[llvm] [LV] Use VPReductionRecipe for partial reductions (PR #144908)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 08:39:01 PDT 2025


================
@@ -994,11 +994,22 @@ InstructionCost TargetTransformInfo::getShuffleCost(
 }
 
 TargetTransformInfo::PartialReductionExtendKind
-TargetTransformInfo::getPartialReductionExtendKind(Instruction *I) {
-  if (isa<SExtInst>(I))
-    return PR_SignExtend;
-  if (isa<ZExtInst>(I))
+TargetTransformInfo::getPartialReductionExtendKind(
+    Instruction::CastOps CastOpc) {
+  switch (CastOpc) {
+  case Instruction::CastOps::ZExt:
     return PR_ZeroExtend;
+  case Instruction::CastOps::SExt:
+    return PR_SignExtend;
+  default:
+    return PR_None;
+  }
+}
+
+TargetTransformInfo::PartialReductionExtendKind
+TargetTransformInfo::getPartialReductionExtendKind(Instruction *I) {
----------------
sdesmalen-arm wrote:

This function can be removed. There's still one use in `VPRecipeBuilder::getScaledReductions`, but there the code can assume the input value is a zero/sign-extend, because of the `match()` clause above.

Can you pull out that change into a separate NFC commit?

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


More information about the llvm-commits mailing list