@@ -313,30 +313,22 @@ collectVirtualRegUses(SmallVectorImpl<VRegMaskOrUnit> &VRegMaskOrUnits,
313313// / Mostly copy/paste from CodeGen/RegisterPressure.cpp
314314static LaneBitmask getLanesWithProperty (
315315 const LiveIntervals &LIS, const MachineRegisterInfo &MRI,
316- bool TrackLaneMasks, VirtRegOrUnit VRegOrUnit, SlotIndex Pos,
317- LaneBitmask SafeDefault,
316+ bool TrackLaneMasks, Register Reg, SlotIndex Pos,
318317 function_ref<bool (const LiveRange &LR, SlotIndex Pos)> Property) {
319- if (VRegOrUnit.isVirtualReg ()) {
320- const LiveInterval &LI = LIS.getInterval (VRegOrUnit.asVirtualReg ());
321- LaneBitmask Result;
322- if (TrackLaneMasks && LI.hasSubRanges ()) {
323- for (const LiveInterval::SubRange &SR : LI.subranges ()) {
324- if (Property (SR, Pos))
325- Result |= SR.LaneMask ;
326- }
327- } else if (Property (LI, Pos)) {
328- Result = TrackLaneMasks
329- ? MRI.getMaxLaneMaskForVReg (VRegOrUnit.asVirtualReg ())
330- : LaneBitmask::getAll ();
318+ assert (Reg.isVirtual ());
319+ const LiveInterval &LI = LIS.getInterval (Reg);
320+ LaneBitmask Result;
321+ if (TrackLaneMasks && LI.hasSubRanges ()) {
322+ for (const LiveInterval::SubRange &SR : LI.subranges ()) {
323+ if (Property (SR, Pos))
324+ Result |= SR.LaneMask ;
331325 }
332-
333- return Result;
326+ } else if (Property (LI, Pos)) {
327+ Result =
328+ TrackLaneMasks ? MRI.getMaxLaneMaskForVReg (Reg) : LaneBitmask::getAll ();
334329 }
335330
336- const LiveRange *LR = LIS.getCachedRegUnit (VRegOrUnit.asMCRegUnit ());
337- if (LR == nullptr )
338- return SafeDefault;
339- return Property (*LR, Pos) ? LaneBitmask::getAll () : LaneBitmask::getNone ();
331+ return Result;
340332}
341333
342334// / Mostly copy/paste from CodeGen/RegisterPressure.cpp
@@ -504,10 +496,9 @@ void GCNRPTracker::reset(const MachineRegisterInfo &MRI_,
504496}
505497
506498// / Mostly copy/paste from CodeGen/RegisterPressure.cpp
507- LaneBitmask GCNRPTracker::getLastUsedLanes (VirtRegOrUnit VRegOrUnit,
508- SlotIndex Pos) const {
499+ LaneBitmask GCNRPTracker::getLastUsedLanes (Register Reg, SlotIndex Pos) const {
509500 return getLanesWithProperty (
510- LIS, *MRI, true , VRegOrUnit , Pos.getBaseIndex (), LaneBitmask::getNone (),
501+ LIS, *MRI, true , Reg , Pos.getBaseIndex (),
511502 [](const LiveRange &LR, SlotIndex Pos) {
512503 const LiveRange::Segment *S = LR.getSegmentContaining (Pos);
513504 return S != nullptr && S->end == Pos.getRegSlot ();
@@ -753,7 +744,7 @@ GCNDownwardRPTracker::bumpDownwardPressure(const MachineInstr *MI,
753744 if (!Use.VRegOrUnit .isVirtualReg ())
754745 continue ;
755746 Register Reg = Use.VRegOrUnit .asVirtualReg ();
756- LaneBitmask LastUseMask = getLastUsedLanes (Use. VRegOrUnit , SlotIdx);
747+ LaneBitmask LastUseMask = getLastUsedLanes (Reg , SlotIdx);
757748 if (LastUseMask.none ())
758749 continue ;
759750 // The LastUseMask is queried from the liveness information of instruction
0 commit comments