[llvm] fc71b2c - [VPlan] Get opcode from recipe in VPWidenMemRecipe::computeCost (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 20 06:30:05 PDT 2025
Author: Florian Hahn
Date: 2025-04-20T14:25:32+01:00
New Revision: fc71b2c8db5d0a648ca5417e4c502755bfbe75b6
URL: https://github.com/llvm/llvm-project/commit/fc71b2c8db5d0a648ca5417e4c502755bfbe75b6
DIFF: https://github.com/llvm/llvm-project/commit/fc71b2c8db5d0a648ca5417e4c502755bfbe75b6.diff
LOG: [VPlan] Get opcode from recipe in VPWidenMemRecipe::computeCost (NFC).
Remove some uses of the underlying ingredient by getting the opcode
directly via the recipe ID.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index ff1ad29e75e2d..c2cfd93d23ec0 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -2686,6 +2686,9 @@ InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
getLoadStoreAlignment(const_cast<Instruction *>(&Ingredient));
unsigned AS = cast<PointerType>(Ctx.Types.inferScalarType(getAddr()))
->getAddressSpace();
+ unsigned Opcode = isa<VPWidenLoadRecipe, VPWidenLoadEVLRecipe>(this)
+ ? Instruction::Load
+ : Instruction::Store;
if (!Consecutive) {
// TODO: Using the original IR may not be accurate.
@@ -2695,20 +2698,19 @@ InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
assert(!Reverse &&
"Inconsecutive memory access should not have the order.");
return Ctx.TTI.getAddressComputationCost(Ty) +
- Ctx.TTI.getGatherScatterOpCost(Ingredient.getOpcode(), Ty, Ptr,
- IsMasked, Alignment, Ctx.CostKind,
- &Ingredient);
+ Ctx.TTI.getGatherScatterOpCost(Opcode, Ty, Ptr, IsMasked, Alignment,
+ Ctx.CostKind, &Ingredient);
}
InstructionCost Cost = 0;
if (IsMasked) {
- Cost += Ctx.TTI.getMaskedMemoryOpCost(Ingredient.getOpcode(), Ty, Alignment,
- AS, Ctx.CostKind);
+ Cost +=
+ Ctx.TTI.getMaskedMemoryOpCost(Opcode, Ty, Alignment, AS, Ctx.CostKind);
} else {
TTI::OperandValueInfo OpInfo =
Ctx.TTI.getOperandInfo(Ingredient.getOperand(0));
- Cost += Ctx.TTI.getMemoryOpCost(Ingredient.getOpcode(), Ty, Alignment, AS,
- Ctx.CostKind, OpInfo, &Ingredient);
+ Cost += Ctx.TTI.getMemoryOpCost(Opcode, Ty, Alignment, AS, Ctx.CostKind,
+ OpInfo, &Ingredient);
}
if (!Reverse)
return Cost;
More information about the llvm-commits
mailing list