@@ -907,13 +907,13 @@ bool GCNRegPressurePrinter::runOnMachineFunction(MachineFunction &MF) {
907907 OS << " :\n " ;
908908
909909 SlotIndex MBBStartSlot = LIS.getSlotIndexes ()->getMBBStartIdx (&MBB);
910- SlotIndex MBBEndSlot = LIS.getSlotIndexes ()->getMBBEndIdx (&MBB);
911910 SlotIndex MBBLastSlot = LIS.getSlotIndexes ()->getMBBLastIdx (&MBB);
911+ bool MBBHasNonDebugInstrs = MBBStartSlot != MBBLastSlot.getBaseIndex ();
912912
913913 GCNRPTracker::LiveRegSet LiveIn, LiveOut;
914914 GCNRegPressure RPAtMBBEnd;
915915
916- if (!MBBLastSlot. isValid ()) { // MBB doesn't have any non-debug instrs.
916+ if (!MBBHasNonDebugInstrs) {
917917 LiveIn = LiveOut = getLiveRegs (MBBStartSlot, LIS, MRI);
918918 RPAtMBBEnd = getRegPressure (MRI, LiveIn);
919919 } else if (UseDownwardTracker) {
@@ -966,13 +966,14 @@ bool GCNRegPressurePrinter::runOnMachineFunction(MachineFunction &MF) {
966966 OS << printRP (RPAtMBBEnd) << ' \n ' ;
967967
968968 OS << PFX " Live-out:" << llvm::print (LiveOut, MRI);
969- if (UseDownwardTracker && MBBLastSlot. isValid () )
969+ if (UseDownwardTracker)
970970 ReportLISMismatchIfAny (LiveOut, getLiveRegs (MBBLastSlot, LIS, MRI));
971971
972972 GCNRPTracker::LiveRegSet LiveThrough;
973973 for (auto [Reg, Mask] : LiveIn) {
974974 LaneBitmask MaskIntersection = Mask & LiveOut.lookup (Reg);
975975 if (MaskIntersection.any ()) {
976+ SlotIndex MBBEndSlot = LIS.getSlotIndexes ()->getMBBEndIdx (&MBB);
976977 LaneBitmask LTMask = getRegLiveThroughMask (
977978 MRI, LIS, Reg, MBBStartSlot, MBBEndSlot, MaskIntersection);
978979 if (LTMask.any ())
0 commit comments