Skip to content

Commit f4378f6

Browse files
committed
s/TargetTransformInfo/TTI, rm TargetScaleFactor change
1 parent 90f399b commit f4378f6

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8250,26 +8250,22 @@ bool VPRecipeBuilder::getScaledReductions(
82508250
return false;
82518251

82528252
TTI::PartialReductionExtendKind OpAExtend =
8253-
TargetTransformInfo::getPartialReductionExtendKind(Exts[0]);
8253+
TTI::getPartialReductionExtendKind(Exts[0]);
82548254
TTI::PartialReductionExtendKind OpBExtend =
8255-
Exts[1] ? TargetTransformInfo::getPartialReductionExtendKind(Exts[1])
8256-
: TargetTransformInfo::PR_None;
8255+
Exts[1] ? TTI::getPartialReductionExtendKind(Exts[1]) : TTI::PR_None;
82578256
PartialReductionChain Chain(RdxExitInstr, Exts[0], Exts[1], ExtendUser);
82588257

82598258
TypeSize PHISize = PHI->getType()->getPrimitiveSizeInBits();
82608259
TypeSize ASize = ExtOpTypes[0]->getPrimitiveSizeInBits();
82618260
if (!PHISize.hasKnownScalarFactor(ASize))
82628261
return false;
8263-
8264-
unsigned TargetScaleFactor =
8265-
PHI->getType()->getPrimitiveSizeInBits().getKnownScalarFactor(
8266-
ExtOpTypes[0]->getPrimitiveSizeInBits());
8262+
unsigned TargetScaleFactor = PHISize.getKnownScalarFactor(ASize);
82678263

82688264
if (LoopVectorizationPlanner::getDecisionAndClampRange(
82698265
[&](ElementCount VF) {
82708266
InstructionCost Cost = TTI->getPartialReductionCost(
8271-
Update->getOpcode(), ExtOpTypes[0], ExtOpTypes[1], PHI->getType(),
8272-
VF, OpAExtend, OpBExtend, BinOpc, CM.CostKind);
8267+
Update->getOpcode(), ExtOpTypes[0], ExtOpTypes[1],
8268+
PHI->getType(), VF, OpAExtend, OpBExtend, BinOpc, CM.CostKind);
82738269
return Cost.isValid();
82748270
},
82758271
Range)) {

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -307,20 +307,20 @@ VPPartialReductionRecipe::computeCost(ElementCount VF,
307307
}
308308

309309
Type *InputTypeA = nullptr, *InputTypeB = nullptr;
310-
TTI::PartialReductionExtendKind ExtAType = TargetTransformInfo::PR_None,
311-
ExtBType = TargetTransformInfo::PR_None;
310+
TTI::PartialReductionExtendKind ExtAType = TTI::PR_None,
311+
ExtBType = TTI::PR_None;
312312

313313
auto GetExtendKind = [](VPRecipeBase *R) {
314314
if (!R)
315-
return TargetTransformInfo::PR_None;
315+
return TTI::PR_None;
316316
auto *WidenCastR = dyn_cast<VPWidenCastRecipe>(R);
317317
if (!WidenCastR)
318-
return TargetTransformInfo::PR_None;
318+
return TTI::PR_None;
319319
if (WidenCastR->getOpcode() == Instruction::CastOps::ZExt)
320-
return TargetTransformInfo::PR_ZeroExtend;
320+
return TTI::PR_ZeroExtend;
321321
if (WidenCastR->getOpcode() == Instruction::CastOps::SExt)
322-
return TargetTransformInfo::PR_SignExtend;
323-
return TargetTransformInfo::PR_None;
322+
return TTI::PR_SignExtend;
323+
return TTI::PR_None;
324324
};
325325

326326
// Pick out opcode, type/ext information and use sub side effects from a widen
@@ -357,9 +357,9 @@ VPPartialReductionRecipe::computeCost(ElementCount VF,
357357
return Reduction->computeCost(VF, Ctx);
358358
}
359359
auto *PhiType = Ctx.Types.inferScalarType(getOperand(1));
360-
return Ctx.TTI.getPartialReductionCost(
361-
getOpcode(), InputTypeA, InputTypeB, PhiType, VF, ExtAType,
362-
ExtBType, Opcode, Ctx.CostKind);
360+
return Ctx.TTI.getPartialReductionCost(getOpcode(), InputTypeA, InputTypeB,
361+
PhiType, VF, ExtAType, ExtBType,
362+
Opcode, Ctx.CostKind);
363363
}
364364

365365
void VPPartialReductionRecipe::execute(VPTransformState &State) {

0 commit comments

Comments
 (0)