[all-commits] [llvm/llvm-project] dc01d7: [SlotIndexes] Add queries for stale indexes

Petar Jovanovic via All-commits all-commits at lists.llvm.org
Sun Sep 27 17:57:29 PDT 2026


  Branch: refs/heads/users/petar-jovanovic/ldv-stale-slot-indexes
  Home:   https://github.com/llvm/llvm-project
  Commit: dc01d7f237050c73eb3f8b9e6f2ef1a0a9dc0d07
      https://github.com/llvm/llvm-project/commit/dc01d7f237050c73eb3f8b9e6f2ef1a0a9dc0d07
  Author: Petar Jovanovic <petar.jovanovic at amd.com>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M llvm/include/llvm/CodeGen/SlotIndexes.h
    M llvm/lib/CodeGen/SlotIndexes.cpp
    M llvm/unittests/CodeGen/CMakeLists.txt
    A llvm/unittests/CodeGen/SlotIndexesTest.cpp

  Log Message:
  -----------
  [SlotIndexes] Add queries for stale indexes

An erased instruction leaves its index list entry in place, making the
index indistinguishable from a block boundary entry. Add
isBlockBoundaryIndex() and isStaleIndex() to tell the two apart, and
canonicalizeIndex() to resolve a stale index to the closest preceding
instruction's register slot, or the block start if none survives.

NFC. No caller yet. LiveDebugVariables is next.


  Commit: 355a730bf4a0d37f68c91f67278ea839ad51726e
      https://github.com/llvm/llvm-project/commit/355a730bf4a0d37f68c91f67278ea839ad51726e
  Author: Petar Jovanovic <petar.jovanovic at amd.com>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M llvm/include/llvm/CodeGen/LiveDebugVariables.h
    M llvm/lib/CodeGen/LiveDebugVariables.cpp
    M llvm/lib/CodeGen/RegAllocGreedy.cpp
    M llvm/test/CodeGen/X86/debug-spilled-snippet.ll
    M llvm/test/CodeGen/X86/debug-spilled-snippet.mir
    A llvm/test/DebugInfo/AMDGPU/live-debug-vars-stale-slot-indexes.ll
    M llvm/test/DebugInfo/MIR/X86/live-debug-vars-unused-arg-debugonly.mir

  Log Message:
  -----------
  [LiveDebugVariables] Repair stale SlotIndexes

The analysis keeps its indexes from before the first register allocator
until DBG_VALUEs are emitted, by which point passes in between have
erased some of the instructions they point at. Resolve them at the
start of each allocator run and before emitting.

SlotIndexes can then reclaim the entries of erased instructions without
sparing the ones held here, which would have made generated code depend
on -g. Emitted locations are unchanged, except that intervals resolving
to one position now emit a single DBG_VALUE rather than identical
consecutive ones.


Compare: https://github.com/llvm/llvm-project/compare/cd6a819e990d...355a730bf4a0

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list