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

Petar Jovanovic via All-commits all-commits at lists.llvm.org
Wed Sep 16 05:04:13 PDT 2026


  Branch: refs/heads/users/petar-jovanovic/slotindexes-compaction
  Home:   https://github.com/llvm/llvm-project
  Commit: 5191578746e2ecd3a99e33426423a71842a70ef4
      https://github.com/llvm/llvm-project/commit/5191578746e2ecd3a99e33426423a71842a70ef4
  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