@@ -939,11 +939,9 @@ void GCNScheduleDAGMILive::finalizeSchedule() {
939939 Pressure.resize (Regions.size ());
940940 RegionsWithHighRP.resize (Regions.size ());
941941 RegionsWithExcessRP.resize (Regions.size ());
942- RegionsWithMinOcc.resize (Regions.size ());
943942 RegionsWithIGLPInstrs.resize (Regions.size ());
944943 RegionsWithHighRP.reset ();
945944 RegionsWithExcessRP.reset ();
946- RegionsWithMinOcc.reset ();
947945 RegionsWithIGLPInstrs.reset ();
948946
949947 runSchedStages ();
@@ -1093,8 +1091,7 @@ bool PreRARematStage::initGCNSchedStage() {
10931091 // fixed if there is another pass after this pass.
10941092 assert (!S.hasNextStage ());
10951093
1096- if (!GCNSchedStage::initGCNSchedStage () || DAG.RegionsWithMinOcc .none () ||
1097- DAG.Regions .size () == 1 )
1094+ if (!GCNSchedStage::initGCNSchedStage () || DAG.Regions .size () == 1 )
10981095 return false ;
10991096
11001097 // Before performing any IR modification record the parent region of each MI
@@ -1136,10 +1133,6 @@ void UnclusteredHighRPStage::finalizeGCNSchedStage() {
11361133 SavedMutations.swap (DAG.Mutations );
11371134 S.SGPRLimitBias = S.VGPRLimitBias = 0 ;
11381135 if (DAG.MinOccupancy > InitialOccupancy) {
1139- for (unsigned IDX = 0 ; IDX < DAG.Pressure .size (); ++IDX)
1140- DAG.RegionsWithMinOcc [IDX] =
1141- DAG.Pressure [IDX].getOccupancy (DAG.ST ) == DAG.MinOccupancy ;
1142-
11431136 LLVM_DEBUG (dbgs () << StageID
11441137 << " stage successfully increased occupancy to "
11451138 << DAG.MinOccupancy << ' \n ' );
@@ -1211,11 +1204,13 @@ bool GCNSchedStage::initGCNRegion() {
12111204}
12121205
12131206bool UnclusteredHighRPStage::initGCNRegion () {
1214- // Only reschedule regions with the minimum occupancy or regions that may have
1215- // spilling (excess register pressure).
1216- if ((!DAG.RegionsWithMinOcc [RegionIdx] ||
1217- DAG.MinOccupancy <= InitialOccupancy) &&
1218- !DAG.RegionsWithExcessRP [RegionIdx])
1207+ // Only reschedule regions that have excess register pressure (i.e. spilling)
1208+ // or had minimum occupancy at the beginning of the stage (as long as
1209+ // rescheduling of previous regions did not make occupancy drop back down to
1210+ // the initial minimum).
1211+ if (!DAG.RegionsWithExcessRP [RegionIdx] &&
1212+ (DAG.MinOccupancy <= InitialOccupancy ||
1213+ DAG.Pressure [RegionIdx].getOccupancy (ST) != InitialOccupancy))
12191214 return false ;
12201215
12211216 return GCNSchedStage::initGCNRegion ();
@@ -1278,8 +1273,6 @@ void GCNSchedStage::checkScheduling() {
12781273 if (PressureAfter.getSGPRNum () <= S.SGPRCriticalLimit &&
12791274 PressureAfter.getVGPRNum (ST.hasGFX90AInsts ()) <= S.VGPRCriticalLimit ) {
12801275 DAG.Pressure [RegionIdx] = PressureAfter;
1281- DAG.RegionsWithMinOcc [RegionIdx] =
1282- PressureAfter.getOccupancy (ST) == DAG.MinOccupancy ;
12831276
12841277 // Early out if we have achieved the occupancy target.
12851278 LLVM_DEBUG (dbgs () << " Pressure in desired limits, done.\n " );
@@ -1313,7 +1306,6 @@ void GCNSchedStage::checkScheduling() {
13131306 if (NewOccupancy < DAG.MinOccupancy ) {
13141307 DAG.MinOccupancy = NewOccupancy;
13151308 MFI.limitOccupancy (DAG.MinOccupancy );
1316- DAG.RegionsWithMinOcc .reset ();
13171309 LLVM_DEBUG (dbgs () << " Occupancy lowered for the function to "
13181310 << DAG.MinOccupancy << " .\n " );
13191311 }
@@ -1335,13 +1327,10 @@ void GCNSchedStage::checkScheduling() {
13351327
13361328 // Revert if this region's schedule would cause a drop in occupancy or
13371329 // spilling.
1338- if (shouldRevertScheduling (WavesAfter)) {
1330+ if (shouldRevertScheduling (WavesAfter))
13391331 revertScheduling ();
1340- } else {
1332+ else
13411333 DAG.Pressure [RegionIdx] = PressureAfter;
1342- DAG.RegionsWithMinOcc [RegionIdx] =
1343- PressureAfter.getOccupancy (ST) == DAG.MinOccupancy ;
1344- }
13451334}
13461335
13471336unsigned
@@ -1567,8 +1556,6 @@ bool GCNSchedStage::mayCauseSpilling(unsigned WavesAfter) {
15671556}
15681557
15691558void GCNSchedStage::revertScheduling () {
1570- DAG.RegionsWithMinOcc [RegionIdx] =
1571- PressureBefore.getOccupancy (ST) == DAG.MinOccupancy ;
15721559 LLVM_DEBUG (dbgs () << " Attempting to revert scheduling.\n " );
15731560 DAG.RegionEnd = DAG.RegionBegin ;
15741561 int SkippedDebugInstr = 0 ;
0 commit comments