[llvm] [InstrRef] Skip clobbered EntryValue register recovery (PR #142478)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 26 06:09:19 PDT 2025


================
@@ -428,12 +431,14 @@ class TransferTracker {
     // The LiveIn value is available at block entry, begin tracking and record
     // the transfer.
     for (const ResolvedDbgOp &Op : ResolvedDbgOps)
-      if (!Op.IsConst)
+      if (!Op.IsConst && !DbgLocAvailableAndIsEntryVal)
         ActiveMLocs[Op.Loc].insert(VarID);
     auto NewValue = ResolvedDbgValue{ResolvedDbgOps, Value.Properties};
-    auto Result = ActiveVLocs.insert(std::make_pair(VarID, NewValue));
-    if (!Result.second)
-      Result.first->second = NewValue;
+    if (!DbgLocAvailableAndIsEntryVal) {
+      auto Result = ActiveVLocs.insert(std::make_pair(VarID, NewValue));
+      if (!Result.second)
+        Result.first->second = NewValue;
+    }
     auto &[Var, DILoc] = DVMap.lookupDVID(VarID);
     PendingDbgValues.push_back(
         std::make_pair(VarID, &*MTracker->emitLoc(ResolvedDbgOps, Var, DILoc,
----------------
jmorse wrote:

Could we instead hoist this code a little earlier, and then early-exit if DbgLocAvailableAndIsEntryValue is set? So it'd go:
 * Emit the pending DBG_VALUE,
 * Potentially early-exit,
 * Enter things into ActiveMLocs and ActiveVLocs

Which'd avoid the reader having to think about the different flag interactions.

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


More information about the llvm-commits mailing list