@@ -1137,6 +1137,9 @@ class SlotIndexUpdateDelegate : public MachineFunction::Delegate {
11371137 }
11381138};
11391139
1140+ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge (
1141+ MachineBasicBlock *Succ, Pass *P, MachineFunctionAnalysisManager *MFAM,
1142+ std::vector<SparseBitVector<>> *LiveInSets, MachineDomTreeUpdater *MDTU) {
11401143#define GET_RESULT (RESULT, GETTER, INFIX ) \
11411144 [MF, P, MFAM]() { \
11421145 if (P) { \
@@ -1146,10 +1149,19 @@ class SlotIndexUpdateDelegate : public MachineFunction::Delegate {
11461149 return MFAM->getCachedResult <RESULT##Analysis>(*MF); \
11471150 }()
11481151
1152+ assert ((P || MFAM) && " Need a way to get analysis results!" );
1153+ MachineFunction *MF = getParent ();
1154+ LiveIntervals *LIS = GET_RESULT (LiveIntervals, getLIS, );
1155+ SlotIndexes *Indexes = GET_RESULT (SlotIndexes, getSI, );
1156+ LiveVariables *LV = GET_RESULT (LiveVariables, getLV, );
1157+ MachineLoopInfo *MLI = GET_RESULT (MachineLoop, getLI, Info);
1158+ return SplitCriticalEdge (Succ, {LIS, Indexes, LV, MLI}, LiveInSets, MDTU);
1159+ #undef GET_RESULT
1160+ }
1161+
11491162MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge (
1150- MachineBasicBlock *Succ, Pass *P, MachineFunctionAnalysisManager *MFAM ,
1163+ MachineBasicBlock *Succ, const SplitCriticalEdgeAnalyses &Analyses ,
11511164 std::vector<SparseBitVector<>> *LiveInSets, MachineDomTreeUpdater *MDTU) {
1152- assert ((P || MFAM) && " Need a way to get analysis results!" );
11531165 if (!canSplitCriticalEdge (Succ))
11541166 return nullptr ;
11551167
@@ -1172,19 +1184,16 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
11721184 LLVM_DEBUG (dbgs () << " Splitting critical edge: " << printMBBReference (*this )
11731185 << " -- " << printMBBReference (*NMBB) << " -- "
11741186 << printMBBReference (*Succ) << ' \n ' );
1175-
1176- LiveIntervals *LIS = GET_RESULT (LiveIntervals, getLIS, );
1177- SlotIndexes *Indexes = GET_RESULT (SlotIndexes, getSI, );
1187+ auto *LIS = Analyses.LIS ;
11781188 if (LIS)
11791189 LIS->insertMBBInMaps (NMBB);
1180- else if (Indexes )
1181- Indexes ->insertMBBInMaps (NMBB);
1190+ else if (Analyses. SI )
1191+ Analyses. SI ->insertMBBInMaps (NMBB);
11821192
11831193 // On some targets like Mips, branches may kill virtual registers. Make sure
11841194 // that LiveVariables is properly updated after updateTerminator replaces the
11851195 // terminators.
1186- LiveVariables *LV = GET_RESULT (LiveVariables, getLV, );
1187-
1196+ auto *LV = Analyses.LV ;
11881197 // Collect a list of virtual registers killed by the terminators.
11891198 SmallVector<Register, 4 > KilledRegs;
11901199 if (LV)
@@ -1223,7 +1232,7 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
12231232 // as the fallthrough successor
12241233 if (Succ == PrevFallthrough)
12251234 PrevFallthrough = NMBB;
1226-
1235+ auto *Indexes = Analyses. SI ;
12271236 if (!ChangedIndirectJump) {
12281237 SlotIndexUpdateDelegate SlotUpdater (*MF, Indexes);
12291238 updateTerminator (PrevFallthrough);
@@ -1351,7 +1360,7 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
13511360 if (MDTU)
13521361 MDTU->splitCriticalEdge (this , Succ, NMBB);
13531362
1354- if (MachineLoopInfo *MLI = GET_RESULT (MachineLoop, getLI, Info) )
1363+ if (MachineLoopInfo *MLI = Analyses. MLI )
13551364 if (MachineLoop *TIL = MLI->getLoopFor (this )) {
13561365 // If one or the other blocks were not in a loop, the new block is not
13571366 // either, and thus LI doesn't need to be updated.
0 commit comments