[llvm] [AMDGPU] NFC: Provide RPTracker interface for external iterators (PR #93088)
Jeffrey Byrnes via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 13:58:59 PDT 2024
================
@@ -414,6 +534,49 @@ void GCNUpwardRPTracker::recede(const MachineInstr &MI) {
assert(CurPressure == getRegPressure(*MRI, LiveRegs));
}
+void GCNUpwardRPTracker::bumpUpwardPressure(const MachineInstr *MI,
+ const SIRegisterInfo *TRI) {
+ assert(!MI->isDebugOrPseudoInstr() && "Expect a nondebug instruction.");
+
+ SlotIndex SlotIdx = LIS.getInstructionIndex(*MI).getRegSlot();
+
+ // Account for register pressure similar to RegPressureTracker::recede().
+ RegisterOperands RegOpers;
+
+ RegOpers.collect(*MI, *TRI, *MRI, true, /*IgnoreDead=*/true);
+ assert(RegOpers.DeadDefs.empty());
+ adjustDefLaneLiveness(RegOpers.Defs, SlotIdx, LIS, *MRI);
+ RegOpers.detectDeadDefs(*MI, LIS);
+
+ // Boost max pressure for all dead defs together.
+ // Since CurrSetPressure and MaxSetPressure
+ bumpDeadDefs(RegOpers.DeadDefs);
+
+ // Kill liveness at live defs.
+ for (const RegisterMaskPair &P : RegOpers.Defs) {
+ Register Reg = P.RegUnit;
+ if (!Reg.isVirtual())
+ continue;
+ LaneBitmask LiveAfter = LiveRegs[Reg];
+ LaneBitmask UseLanes = getRegLanes(RegOpers.Uses, Reg);
+ LaneBitmask DefLanes = P.LaneMask;
+ LaneBitmask LiveBefore = (LiveAfter & ~DefLanes) | UseLanes;
+
+ CurPressure.inc(Reg, LiveAfter, LiveAfter & LiveBefore, *MRI);
----------------
jrbyrnes wrote:
see https://github.com/llvm/llvm-project/pull/93090/files/80e066cd1da82d1d55b74d2b3cab62d8934d9947#r1774010200
https://github.com/llvm/llvm-project/pull/93088
More information about the llvm-commits
mailing list