[llvm] [StackSlotColoring] Fix issue where colors for a StackID are dropped (PR #138140)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Thu May 1 08:27:05 PDT 2025
MacDue wrote:
> Would it be possible to create an MIR test that does a `run-pass=stackslot-coloring`, using objects with `scalable-vector (2)` and `noalloc (255)` stack IDs to expose this case? I don't think this pass cares specifically about the meaning of these stack IDs.
It does not seem possible right now. The `stack-slot-coloring` pass uses the `LiveStacksAnalysis` to find the stack slot live ranges, but that's not a real analysis, it's just a stub, with the actual liveness information filled in by the register allocator. https://github.com/llvm/llvm-project/blob/c61746650178c117996e1787617f36ccda7233f7/llvm/lib/CodeGen/LiveStacks.cpp#L48-L49
So, to get the stack slot liveness information, the register allocator needs to run and create stack slots. Since the register allocator makes the stack slots, I can't edit them to have the `noalloc` StackID. If I run the register allocator separately to generate the MIR, there's no stack slot liveness information, so the `stack-slot-coloring` pass is a nop.
https://github.com/llvm/llvm-project/pull/138140
More information about the llvm-commits
mailing list