@@ -284,18 +284,27 @@ GCNRPTracker::LiveRegSet llvm::getLiveRegs(SlotIndex SI,
284
284
return LiveRegs;
285
285
}
286
286
287
- void GCNUpwardRPTracker::reset (const MachineInstr &MI,
288
- const LiveRegSet *LiveRegsCopy) {
289
- MRI = &MI.getParent ()->getParent ()->getRegInfo ();
287
+ void GCNRPTracker::reset (const MachineInstr &MI,
288
+ const LiveRegSet *LiveRegsCopy,
289
+ bool After) {
290
+ const MachineFunction &MF = *MI.getMF ();
291
+ MRI = &MF.getRegInfo ();
290
292
if (LiveRegsCopy) {
291
293
if (&LiveRegs != LiveRegsCopy)
292
294
LiveRegs = *LiveRegsCopy;
293
295
} else {
294
- LiveRegs = getLiveRegsAfter (MI, LIS);
296
+ LiveRegs = After ? getLiveRegsAfter (MI, LIS)
297
+ : getLiveRegsBefore (MI, LIS);
295
298
}
299
+
296
300
MaxPressure = CurPressure = getRegPressure (*MRI, LiveRegs);
297
301
}
298
302
303
+ void GCNUpwardRPTracker::reset (const MachineInstr &MI,
304
+ const LiveRegSet *LiveRegsCopy) {
305
+ GCNRPTracker::reset (MI, LiveRegsCopy, true );
306
+ }
307
+
299
308
void GCNUpwardRPTracker::recede (const MachineInstr &MI) {
300
309
assert (MRI && " call reset first" );
301
310
@@ -349,13 +358,7 @@ bool GCNDownwardRPTracker::reset(const MachineInstr &MI,
349
358
NextMI = skipDebugInstructionsForward (NextMI, MBBEnd);
350
359
if (NextMI == MBBEnd)
351
360
return false ;
352
- if (LiveRegsCopy) {
353
- if (&LiveRegs != LiveRegsCopy)
354
- LiveRegs = *LiveRegsCopy;
355
- } else {
356
- LiveRegs = getLiveRegsBefore (*NextMI, LIS);
357
- }
358
- MaxPressure = CurPressure = getRegPressure (*MRI, LiveRegs);
361
+ GCNRPTracker::reset (*NextMI, LiveRegsCopy, false );
359
362
return true ;
360
363
}
361
364
0 commit comments