================
@@ -596,11 +709,33 @@ void GCNUpwardRPTracker::recede(const MachineInstr &MI) {
     CurPressure.inc(U.VRegOrUnit.asVirtualReg(), PrevMask, LiveMask, *MRI);
   }
 
+  if (TrackPhysRegs) {
+    // Physical register handling needs the register directly to avoid 
aliasing,
+    // so we need to iterate over all uses.
+    for (const MachineOperand &MO : MI.all_uses()) {
+      if (!MO.isReg() || !MO.getReg().isPhysical() || !MO.readsReg())
+        continue;
+      Register Reg = MO.getReg();
+      if (!MRI->isAllocatable(Reg))
+        continue;
+      bool NewlyLive = insertIfNotLive(Reg.asMCReg());
+      if (NewlyLive)
+        CurPressure.inc(Reg.asMCReg(), /*IsAdd=*/true, *MRI);
+    }
+  }
+
   // Update MaxPressure with uses plus early-clobber defs pressure.
   MaxPressure = HasECDefs ? max(CurPressure + ECDefPressure, MaxPressure)
                           : max(CurPressure, MaxPressure);
 
-  assert(CurPressure == getRegPressure(*MRI, VirtLiveRegs));
+  auto VirtPressure = getRegPressure(*MRI, VirtLiveRegs);
+  auto PhysPressure = constructPhysRegPressure();
----------------
macurtis-amd wrote:

These produce `set but not used` warnings when assertions are off (`NDEBUG` 
defined).

https://github.com/llvm/llvm-project/pull/184275
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to