[llvm] [AMDGPU] Register allocation anti-hints to reduce MFMA hazard NOPs (PR #156943)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 6 07:59:05 PST 2026
================
@@ -674,3 +677,26 @@ bool MachineRegisterInfo::isReservedRegUnit(MCRegUnit Unit) const {
}
return false;
}
+
+void MachineRegisterInfo::getPhysRegAntiHints(
+ Register VReg, SmallVectorImpl<MCPhysReg> &PhysAntiHints,
+ const VirtRegMap &VRM) const {
+ assert(VReg.isVirtual());
+ if (!AntiHintRegs.inBounds(VReg))
+ return;
+
+ const SmallVector<Register, 4> &AntiHints = AntiHintRegs[VReg];
+
+ for (Register AntiHintVReg : AntiHints) {
+ // Check if the anti-hinted register has been allocated
+ if (VRM.hasPhys(AntiHintVReg)) {
+ MCPhysReg PhysReg = VRM.getPhys(AntiHintVReg);
+ // Add the physical register
+ PhysAntiHints.push_back(PhysReg);
+ }
+ }
+
+ // Remove duplicates
+ llvm::sort(PhysAntiHints);
----------------
arsenm wrote:
Do regular hints manage the sorting this way? At least for live-ins, it's faster to do the sort and unique after bulk additions. Should this also be skipped if you didn't push above?
https://github.com/llvm/llvm-project/pull/156943
More information about the llvm-commits
mailing list