@@ -1097,14 +1097,15 @@ RegsForValue::getRegsAndSizes() const {
10971097}
10981098
10991099void SelectionDAGBuilder::init(GCFunctionInfo *gfi, BatchAAResults *aa,
1100- AssumptionCache *ac,
1101- const TargetLibraryInfo *li ) {
1100+ AssumptionCache *ac, const TargetLibraryInfo *li,
1101+ const TargetTransformInfo &TTI ) {
11021102 BatchAA = aa;
11031103 AC = ac;
11041104 GFI = gfi;
11051105 LibInfo = li;
11061106 Context = DAG.getContext();
11071107 LPadToCallSiteMap.clear();
1108+ this->TTI = &TTI;
11081109 SL->init(DAG.getTargetLoweringInfo(), TM, DAG.getDataLayout());
11091110 AssignmentTrackingEnabled = isAssignmentTrackingEnabled(
11101111 *DAG.getMachineFunction().getFunction().getParent());
@@ -2589,10 +2590,6 @@ bool SelectionDAGBuilder::shouldKeepJumpConditionsTogether(
25892590 if (!LhsDeps.contains(RhsI))
25902591 RhsDeps.try_emplace(RhsI, false);
25912592
2592- const auto &TLI = DAG.getTargetLoweringInfo();
2593- const auto &TTI =
2594- TLI.getTargetMachine().getTargetTransformInfo(*I.getFunction());
2595-
25962593 InstructionCost CostOfIncluding = 0;
25972594 // See if this instruction will need to computed independently of whether RHS
25982595 // is.
@@ -2632,8 +2629,8 @@ bool SelectionDAGBuilder::shouldKeepJumpConditionsTogether(
26322629 // RHS condition. Use latency because we are essentially trying to calculate
26332630 // the cost of the dependency chain.
26342631 // Possible TODO: We could try to estimate ILP and make this more precise.
2635- CostOfIncluding +=
2636- TTI.getInstructionCost( InsPair.first, TargetTransformInfo::TCK_Latency);
2632+ CostOfIncluding += TTI->getInstructionCost(
2633+ InsPair.first, TargetTransformInfo::TCK_Latency);
26372634
26382635 if (CostOfIncluding > CostThresh)
26392636 return false;
@@ -4915,10 +4912,9 @@ void SelectionDAGBuilder::visitMaskedStore(const CallInst &I,
49154912 LocationSize::beforeOrAfterPointer(), Alignment, I.getAAMetadata());
49164913
49174914 const auto &TLI = DAG.getTargetLoweringInfo();
4918- const auto &TTI =
4919- TLI.getTargetMachine().getTargetTransformInfo(*I.getFunction());
4915+
49204916 SDValue StoreNode =
4921- !IsCompressing && TTI. hasConditionalLoadStoreForType(
4917+ !IsCompressing && TTI-> hasConditionalLoadStoreForType(
49224918 I.getArgOperand(0)->getType(), /*IsStore=*/true)
49234919 ? TLI.visitMaskedStore(DAG, sdl, getMemoryRoot(), MMO, Ptr, Src0,
49244920 Mask)
@@ -5073,14 +5069,14 @@ void SelectionDAGBuilder::visitMaskedLoad(const CallInst &I, bool IsExpanding) {
50735069 LocationSize::beforeOrAfterPointer(), Alignment, AAInfo, Ranges);
50745070
50755071 const auto &TLI = DAG.getTargetLoweringInfo();
5076- const auto &TTI =
5077- TLI.getTargetMachine().getTargetTransformInfo(*I.getFunction());
5072+
50785073 // The Load/Res may point to different values and both of them are output
50795074 // variables.
50805075 SDValue Load;
50815076 SDValue Res;
5082- if (!IsExpanding && TTI.hasConditionalLoadStoreForType(Src0Operand->getType(),
5083- /*IsStore=*/false))
5077+ if (!IsExpanding &&
5078+ TTI->hasConditionalLoadStoreForType(Src0Operand->getType(),
5079+ /*IsStore=*/false))
50845080 Res = TLI.visitMaskedLoad(DAG, sdl, InChain, MMO, Load, Ptr, Src0, Mask);
50855081 else
50865082 Res = Load =
0 commit comments