[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:57:18 PST 2026
================
@@ -859,6 +866,56 @@ class MachineRegisterInfo {
return RegAllocHints.inBounds(VReg) ? &RegAllocHints[VReg] : nullptr;
}
+ /// addRegAllocAntiHint - Add a register allocation anti-hint for the
+ /// specified virtual register. This tells the allocator to avoid allocating
+ /// VReg to the same physical register as AntiHintVReg (or overlapping ones).
+ void addRegAllocAntiHint(Register VReg, Register AntiHintVReg) {
+ assert(VReg.isVirtual() && "Anti-hints are only for virtual registers");
+ assert(AntiHintVReg.isVirtual() && "Anti-hint target must be virtual");
+ AntiHintRegs.grow(VReg);
+ SmallVector<Register, 4> &AntiHints = AntiHintRegs[VReg];
+ // Avoid duplicates
+ if (llvm::find(AntiHints, AntiHintVReg) == AntiHints.end())
----------------
arsenm wrote:
is_contanied
https://github.com/llvm/llvm-project/pull/156943
More information about the llvm-commits
mailing list