[llvm] [CodeGen] IMPLICIT_DEF must not contribute to Weight in LICM register cost computation (PR #196500)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sat May 9 10:26:37 PDT 2026


================
@@ -969,6 +969,11 @@ MachineLICMImpl::calcRegisterCost(const MachineInstr *MI, bool ConsiderSeen,
     if (MO.isDef())
       RCCost = W.RegWeight;
     else {
+      // IMPLICIT_DEF contributes zero register pressure, so a vreg whose
+      // unique def is IMPLICIT_DEF must not reduce tracked pressure.
+      if (MachineInstr *DefMI = MRI->getUniqueVRegDef(Reg);
----------------
arsenm wrote:

IMPLICIT_DEF can have a register cost, especially if it's live across blocks 

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


More information about the llvm-commits mailing list