Skip to content

Commit c275dd0

Browse files
committed
[AMDGPU] Use VirtRegOrUnit (NFC)
This synchronizes the copy & paste with recent changes to RPTracker.
1 parent ef9a02c commit c275dd0

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

llvm/lib/Target/AMDGPU/GCNRegPressure.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,26 +313,27 @@ collectVirtualRegUses(SmallVectorImpl<VRegMaskOrUnit> &VRegMaskOrUnits,
313313
/// Mostly copy/paste from CodeGen/RegisterPressure.cpp
314314
static LaneBitmask getLanesWithProperty(
315315
const LiveIntervals &LIS, const MachineRegisterInfo &MRI,
316-
bool TrackLaneMasks, Register RegUnit, SlotIndex Pos,
316+
bool TrackLaneMasks, VirtRegOrUnit VRegOrUnit, SlotIndex Pos,
317317
LaneBitmask SafeDefault,
318318
function_ref<bool(const LiveRange &LR, SlotIndex Pos)> Property) {
319-
if (RegUnit.isVirtual()) {
320-
const LiveInterval &LI = LIS.getInterval(RegUnit);
319+
if (VRegOrUnit.isVirtualReg()) {
320+
const LiveInterval &LI = LIS.getInterval(VRegOrUnit.asVirtualReg());
321321
LaneBitmask Result;
322322
if (TrackLaneMasks && LI.hasSubRanges()) {
323323
for (const LiveInterval::SubRange &SR : LI.subranges()) {
324324
if (Property(SR, Pos))
325325
Result |= SR.LaneMask;
326326
}
327327
} else if (Property(LI, Pos)) {
328-
Result = TrackLaneMasks ? MRI.getMaxLaneMaskForVReg(RegUnit)
329-
: LaneBitmask::getAll();
328+
Result = TrackLaneMasks
329+
? MRI.getMaxLaneMaskForVReg(VRegOrUnit.asVirtualReg())
330+
: LaneBitmask::getAll();
330331
}
331332

332333
return Result;
333334
}
334335

335-
const LiveRange *LR = LIS.getCachedRegUnit(RegUnit);
336+
const LiveRange *LR = LIS.getCachedRegUnit(VRegOrUnit.asMCRegUnit());
336337
if (LR == nullptr)
337338
return SafeDefault;
338339
return Property(*LR, Pos) ? LaneBitmask::getAll() : LaneBitmask::getNone();
@@ -503,10 +504,10 @@ void GCNRPTracker::reset(const MachineRegisterInfo &MRI_,
503504
}
504505

505506
/// Mostly copy/paste from CodeGen/RegisterPressure.cpp
506-
LaneBitmask GCNRPTracker::getLastUsedLanes(Register RegUnit,
507+
LaneBitmask GCNRPTracker::getLastUsedLanes(VirtRegOrUnit VRegOrUnit,
507508
SlotIndex Pos) const {
508509
return getLanesWithProperty(
509-
LIS, *MRI, true, RegUnit, Pos.getBaseIndex(), LaneBitmask::getNone(),
510+
LIS, *MRI, true, VRegOrUnit, Pos.getBaseIndex(), LaneBitmask::getNone(),
510511
[](const LiveRange &LR, SlotIndex Pos) {
511512
const LiveRange::Segment *S = LR.getSegmentContaining(Pos);
512513
return S != nullptr && S->end == Pos.getRegSlot();
@@ -752,7 +753,7 @@ GCNDownwardRPTracker::bumpDownwardPressure(const MachineInstr *MI,
752753
if (!Use.VRegOrUnit.isVirtualReg())
753754
continue;
754755
Register Reg = Use.VRegOrUnit.asVirtualReg();
755-
LaneBitmask LastUseMask = getLastUsedLanes(Reg, SlotIdx);
756+
LaneBitmask LastUseMask = getLastUsedLanes(Use.VRegOrUnit, SlotIdx);
756757
if (LastUseMask.none())
757758
continue;
758759
// The LastUseMask is queried from the liveness information of instruction

llvm/lib/Target/AMDGPU/GCNRegPressure.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class GCNRPTracker {
292292
/// Mostly copy/paste from CodeGen/RegisterPressure.cpp
293293
void bumpDeadDefs(ArrayRef<VRegMaskOrUnit> DeadDefs);
294294

295-
LaneBitmask getLastUsedLanes(Register RegUnit, SlotIndex Pos) const;
295+
LaneBitmask getLastUsedLanes(VirtRegOrUnit VRegOrUnit, SlotIndex Pos) const;
296296

297297
public:
298298
// reset tracker and set live register set to the specified value.

0 commit comments

Comments
 (0)