[llvm-branch-commits] [llvm] [LoopVectorizer] Bundle partial reductions inside VPMulAccumulateReductionRecipe (PR #136173)
Sander de Smalen via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Apr 30 06:43:04 PDT 2025
================
@@ -986,11 +986,23 @@ InstructionCost TargetTransformInfo::getShuffleCost(
TargetTransformInfo::PartialReductionExtendKind
TargetTransformInfo::getPartialReductionExtendKind(Instruction *I) {
- if (isa<SExtInst>(I))
- return PR_SignExtend;
- if (isa<ZExtInst>(I))
+ auto *Cast = dyn_cast<CastInst>(I);
+ if (!Cast)
+ return PR_None;
+ return getPartialReductionExtendKind(Cast->getOpcode());
+}
+
+TargetTransformInfo::PartialReductionExtendKind
+TargetTransformInfo::getPartialReductionExtendKind(
+ Instruction::CastOps ExtOpcode) {
+ switch (ExtOpcode) {
+ case Instruction::CastOps::ZExt:
return PR_ZeroExtend;
- return PR_None;
+ case Instruction::CastOps::SExt:
+ return PR_SignExtend;
+ default:
+ return PR_None;
----------------
sdesmalen-arm wrote:
I think the default case should be an `llvm_unreachable()`, because only zero/sign-extend are supported partial reduction extends. The `PR_None` is handled by the function above that takes an `Instruction*`.
https://github.com/llvm/llvm-project/pull/136173
More information about the llvm-branch-commits
mailing list