-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[AMDGPU] Use correct SlotIndex to calculate live-out register set. #161720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -461,6 +461,8 @@ GCNRPTracker::LiveRegSet llvm::getLiveRegs(SlotIndex SI, | |
const LiveIntervals &LIS, | ||
const MachineRegisterInfo &MRI) { | ||
GCNRPTracker::LiveRegSet LiveRegs; | ||
if (!SI.isValid()) | ||
return LiveRegs; | ||
for (unsigned I = 0, E = MRI.getNumVirtRegs(); I != E; ++I) { | ||
auto Reg = Register::index2VirtReg(I); | ||
if (!LIS.hasInterval(Reg)) | ||
|
@@ -905,33 +907,32 @@ bool GCNRegPressurePrinter::runOnMachineFunction(MachineFunction &MF) { | |
OS << ":\n"; | ||
|
||
SlotIndex MBBStartSlot = LIS.getSlotIndexes()->getMBBStartIdx(&MBB); | ||
SlotIndex MBBEndSlot = LIS.getSlotIndexes()->getMBBEndIdx(&MBB); | ||
SlotIndex MBBLastSlot = LIS.getSlotIndexes()->getMBBLastIdx(&MBB); | ||
bool MBBHasNonDebugInstrs = MBBStartSlot != MBBLastSlot.getBaseIndex(); | ||
|
||
|
||
GCNRPTracker::LiveRegSet LiveIn, LiveOut; | ||
GCNRegPressure RPAtMBBEnd; | ||
|
||
if (UseDownwardTracker) { | ||
if (MBB.empty()) { | ||
LiveIn = LiveOut = getLiveRegs(MBBStartSlot, LIS, MRI); | ||
RPAtMBBEnd = getRegPressure(MRI, LiveIn); | ||
} else { | ||
GCNDownwardRPTracker RPT(LIS); | ||
RPT.reset(MBB.front()); | ||
if (!MBBHasNonDebugInstrs) { | ||
LiveIn = LiveOut = getLiveRegs(MBBStartSlot, LIS, MRI); | ||
RPAtMBBEnd = getRegPressure(MRI, LiveIn); | ||
} else if (UseDownwardTracker) { | ||
GCNDownwardRPTracker RPT(LIS); | ||
RPT.reset(MBB.front()); | ||
|
||
LiveIn = RPT.getLiveRegs(); | ||
|
||
while (!RPT.advanceBeforeNext()) { | ||
GCNRegPressure RPBeforeMI = RPT.getPressure(); | ||
RPT.advanceToNext(); | ||
RP.emplace_back(RPBeforeMI, RPT.getPressure()); | ||
} | ||
LiveIn = RPT.getLiveRegs(); | ||
|
||
LiveOut = RPT.getLiveRegs(); | ||
RPAtMBBEnd = RPT.getPressure(); | ||
while (!RPT.advanceBeforeNext()) { | ||
GCNRegPressure RPBeforeMI = RPT.getPressure(); | ||
RPT.advanceToNext(); | ||
RP.emplace_back(RPBeforeMI, RPT.getPressure()); | ||
} | ||
|
||
LiveOut = RPT.getLiveRegs(); | ||
RPAtMBBEnd = RPT.getPressure(); | ||
} else { | ||
GCNUpwardRPTracker RPT(LIS); | ||
RPT.reset(MRI, MBBEndSlot); | ||
RPT.reset(MRI, MBBLastSlot); | ||
|
||
LiveOut = RPT.getLiveRegs(); | ||
RPAtMBBEnd = RPT.getPressure(); | ||
|
@@ -966,12 +967,13 @@ bool GCNRegPressurePrinter::runOnMachineFunction(MachineFunction &MF) { | |
|
||
OS << PFX " Live-out:" << llvm::print(LiveOut, MRI); | ||
if (UseDownwardTracker) | ||
ReportLISMismatchIfAny(LiveOut, getLiveRegs(MBBEndSlot, LIS, MRI)); | ||
ReportLISMismatchIfAny(LiveOut, getLiveRegs(MBBLastSlot, LIS, MRI)); | ||
|
||
GCNRPTracker::LiveRegSet LiveThrough; | ||
for (auto [Reg, Mask] : LiveIn) { | ||
LaneBitmask MaskIntersection = Mask & LiveOut.lookup(Reg); | ||
if (MaskIntersection.any()) { | ||
SlotIndex MBBEndSlot = LIS.getSlotIndexes()->getMBBEndIdx(&MBB); | ||
LaneBitmask LTMask = getRegLiveThroughMask( | ||
MRI, LIS, Reg, MBBStartSlot, MBBEndSlot, MaskIntersection); | ||
if (LTMask.any()) | ||
|
Uh oh!
There was an error while loading. Please reload this page.