Index: include/llvm/CodeGen/TargetSchedule.h =================================================================== --- include/llvm/CodeGen/TargetSchedule.h +++ include/llvm/CodeGen/TargetSchedule.h @@ -50,8 +50,7 @@ /// The machine model API keeps a copy of the top-level MCSchedModel table /// indices and may query TargetSubtargetInfo and TargetInstrInfo to resolve /// dynamic properties. - void init(const MCSchedModel &sm, const TargetSubtargetInfo *sti, - const TargetInstrInfo *tii); + void init(const TargetSubtargetInfo *TSInfo); /// Return the MCSchedClassDesc for this instruction. const MCSchedClassDesc *resolveSchedClass(const MachineInstr *MI) const; Index: lib/CodeGen/IfConversion.cpp =================================================================== --- lib/CodeGen/IfConversion.cpp +++ lib/CodeGen/IfConversion.cpp @@ -347,7 +347,7 @@ BranchFolder::MBFIWrapper MBFI(getAnalysis()); MBPI = &getAnalysis(); MRI = &MF.getRegInfo(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); if (!TII) return false; Index: lib/CodeGen/MachineCombiner.cpp =================================================================== --- lib/CodeGen/MachineCombiner.cpp +++ lib/CodeGen/MachineCombiner.cpp @@ -633,7 +633,7 @@ TII = STI->getInstrInfo(); TRI = STI->getRegisterInfo(); SchedModel = STI->getSchedModel(); - TSchedModel.init(SchedModel, STI, TII); + TSchedModel.init(STI); MRI = &MF.getRegInfo(); MLI = &getAnalysis(); Traces = &getAnalysis(); Index: lib/CodeGen/MachineLICM.cpp =================================================================== --- lib/CodeGen/MachineLICM.cpp +++ lib/CodeGen/MachineLICM.cpp @@ -308,7 +308,7 @@ TRI = ST.getRegisterInfo(); MFI = &MF.getFrameInfo(); MRI = &MF.getRegInfo(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); PreRegAlloc = MRI->isSSA(); Index: lib/CodeGen/MachineTraceMetrics.cpp =================================================================== --- lib/CodeGen/MachineTraceMetrics.cpp +++ lib/CodeGen/MachineTraceMetrics.cpp @@ -70,7 +70,7 @@ TRI = ST.getRegisterInfo(); MRI = &MF->getRegInfo(); Loops = &getAnalysis(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); BlockInfo.resize(MF->getNumBlockIDs()); ProcResourceCycles.resize(MF->getNumBlockIDs() * SchedModel.getNumProcResourceKinds()); Index: lib/CodeGen/ScheduleDAGInstrs.cpp =================================================================== --- lib/CodeGen/ScheduleDAGInstrs.cpp +++ lib/CodeGen/ScheduleDAGInstrs.cpp @@ -118,7 +118,7 @@ DbgValues.clear(); const TargetSubtargetInfo &ST = mf.getSubtarget(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); } /// If this machine instr has memory reference information and it can be Index: lib/CodeGen/TargetSchedule.cpp =================================================================== --- lib/CodeGen/TargetSchedule.cpp +++ lib/CodeGen/TargetSchedule.cpp @@ -61,12 +61,10 @@ return LCM; } -void TargetSchedModel::init(const MCSchedModel &sm, - const TargetSubtargetInfo *sti, - const TargetInstrInfo *tii) { - SchedModel = sm; - STI = sti; - TII = tii; +void TargetSchedModel::init(const TargetSubtargetInfo *TSInfo) { + STI = TSInfo; + SchedModel = TSInfo->getSchedModel(); + TII = TSInfo->getInstrInfo(); STI->initInstrItins(InstrItins); unsigned NumRes = SchedModel.getNumProcResourceKinds(); Index: lib/CodeGen/TargetSubtargetInfo.cpp =================================================================== --- lib/CodeGen/TargetSubtargetInfo.cpp +++ lib/CodeGen/TargetSubtargetInfo.cpp @@ -88,7 +88,7 @@ // We don't cache TSchedModel because it depends on TargetInstrInfo // that could be changed during the compilation TargetSchedModel TSchedModel; - TSchedModel.init(getSchedModel(), this, getInstrInfo()); + TSchedModel.init(this); unsigned Latency = TSchedModel.computeInstrLatency(&MI); Optional RThroughput = TSchedModel.computeInstrRThroughput(&MI); return createSchedInfoStr(Latency, RThroughput); @@ -99,7 +99,7 @@ // We don't cache TSchedModel because it depends on TargetInstrInfo // that could be changed during the compilation TargetSchedModel TSchedModel; - TSchedModel.init(getSchedModel(), this, getInstrInfo()); + TSchedModel.init(this); unsigned Latency; if (TSchedModel.hasInstrSchedModel()) Latency = TSchedModel.computeInstrLatency(MCI.getOpcode()); Index: lib/Target/AArch64/AArch64SIMDInstrOpt.cpp =================================================================== --- lib/Target/AArch64/AArch64SIMDInstrOpt.cpp +++ lib/Target/AArch64/AArch64SIMDInstrOpt.cpp @@ -700,7 +700,7 @@ static_cast(ST.getInstrInfo()); if (!AAII) return false; - SchedModel.init(ST.getSchedModel(), &ST, AAII); + SchedModel.init(&ST); if (!SchedModel.hasInstrSchedModel()) return false; Index: lib/Target/AArch64/AArch64StorePairSuppress.cpp =================================================================== --- lib/Target/AArch64/AArch64StorePairSuppress.cpp +++ lib/Target/AArch64/AArch64StorePairSuppress.cpp @@ -127,7 +127,7 @@ TII = static_cast(ST.getInstrInfo()); TRI = ST.getRegisterInfo(); MRI = &MF.getRegInfo(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); Traces = &getAnalysis(); MinInstr = nullptr; Index: lib/Target/SystemZ/SystemZMachineScheduler.cpp =================================================================== --- lib/Target/SystemZ/SystemZMachineScheduler.cpp +++ lib/Target/SystemZ/SystemZMachineScheduler.cpp @@ -133,7 +133,7 @@ (C->MF->getSubtarget().getInstrInfo())), MBB(nullptr), HazardRec(nullptr) { const TargetSubtargetInfo *ST = &C->MF->getSubtarget(); - SchedModel.init(ST->getSchedModel(), ST, TII); + SchedModel.init(ST); } SystemZPostRASchedStrategy::~SystemZPostRASchedStrategy() { Index: lib/Target/X86/X86CmovConversion.cpp =================================================================== --- lib/Target/X86/X86CmovConversion.cpp +++ lib/Target/X86/X86CmovConversion.cpp @@ -178,7 +178,7 @@ MRI = &MF.getRegInfo(); TII = STI.getInstrInfo(); TRI = STI.getRegisterInfo(); - TSchedModel.init(STI.getSchedModel(), &STI, TII); + TSchedModel.init(&STI); // Before we handle the more subtle cases of register-register CMOVs inside // of potentially hot loops, we want to quickly remove all CMOVs with