[llvm] [AMDGPU] Avoid put implicit_def into bundle that break reg's liveness (PR #142563)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 05:02:18 PDT 2026


================
@@ -94,6 +94,22 @@ static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI,
   return DebugLoc();
 }
 
+/// Check if target reg is contained in given lists, which are:
+/// LocalDefsV as given list for virtual regs
+/// LocalDefsP as given list for physical regs, in BitVector[RegUnit] form
+static bool containsReg(SmallSetVector<Register, 32> LocalDefsV,
+                        const BitVector &LocalDefsP, Register Reg,
+                        const TargetRegisterInfo *TRI) {
+  if (Reg.isPhysical()) {
+    for (MCRegUnit Unit : TRI->regunits(Reg.asMCReg()))
----------------
jayfoad wrote:

This could use `all_of`.

The effect of this is to treat a physreg use as internal if all of its regunits were defined locally, regardless of whether that was a single local def of the whole register or multiple local defs of subregisters. This makes sense to me.

https://github.com/llvm/llvm-project/pull/142563


More information about the llvm-commits mailing list