[all-commits] [llvm/llvm-project] d3303e: [CodeGen] Drop dead SlotIndexes before allocation

Petar Jovanovic via All-commits all-commits at lists.llvm.org
Wed Sep 16 07:20:54 PDT 2026


  Branch: refs/heads/users/petar-jovanovic/slotindexes-compaction
  Home:   https://github.com/llvm/llvm-project
  Commit: d3303eaf307d9da981498e86b99604c6e70c4163
      https://github.com/llvm/llvm-project/commit/d3303eaf307d9da981498e86b99604c6e70c4163
  Author: Petar Jovanovic <petar.jovanovic at amd.com>
  Date:   2026-09-16 (Wed, 16 Sep 2026)

  Changed paths:
    M llvm/include/llvm/CodeGen/LiveDebugVariables.h
    M llvm/include/llvm/CodeGen/LiveIntervals.h
    M llvm/include/llvm/CodeGen/LiveStacks.h
    M llvm/include/llvm/CodeGen/SlotIndexes.h
    M llvm/lib/CodeGen/LiveDebugVariables.cpp
    M llvm/lib/CodeGen/LiveIntervals.cpp
    M llvm/lib/CodeGen/LiveStacks.cpp
    M llvm/lib/CodeGen/RegAllocGreedy.cpp
    M llvm/lib/CodeGen/SlotIndexes.cpp
    A llvm/test/CodeGen/AMDGPU/greedy-compact-slot-indexes.ll
    M llvm/unittests/CodeGen/CMakeLists.txt
    A llvm/unittests/CodeGen/SlotIndexesTest.cpp

  Log Message:
  -----------
  [CodeGen] Drop dead SlotIndexes before allocation

SlotIndexes keeps the index list entry of an erased instruction and only
clears its instruction pointer. Live range sizes are measured in slot
indexes and greedy ranks ranges by size, so the leftovers inflate some
ranges more than others and reorder allocation, spilling heavily on
register-starved functions.

Add SlotIndexes::compactIndexes() to erase them. Erased entries are
unlinked, so LiveIntervals, LiveStacks and LiveDebugVariables first
report the indexes they hold via appendReferencedIndexes(); a missed one
trips an assert instead of dangling.

Off by default behind -greedy-compact-slot-indexes, since it changes
allocation across much of the test suite.



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