-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[StackSlotColoring] Fix issue where colors for a StackID are dropped #138140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In InitializeSlots, if an interval with a non-zero StackID (A) is encountered we set All/UsedColors to a size of A + 1. If after this we process another interval with a non-zero StackID (B), where B < A, then we resize All/UsedColors to size < A + 1, and loose BitVector associated with A.
I don't think anyone has hit this upstream, but I encountered this issue after adding a new TargetStackID locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Title should be more specific about what bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 llvm-project/llvm/lib/CodeGen/LiveStacks.cpp Lines 48 to 49 in c617466
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 |
What if you have pre-existing frame indexes, and then run through the allocator? |
I don't think those are included. IIUC it's only the llvm-project/llvm/lib/CodeGen/InlineSpiller.cpp Lines 1260 to 1264 in a7aca81
getOrCreateInterval anywhere else in the codebase and the InlineSpiller appears to create the stack slots it tracks (in assignVirt2StackSlot() just before).
|
…lvm#138140) In InitializeSlots, if an interval with a non-zero StackID (A) is encountered we set All/UsedColors to a size of A + 1. If after this we process another interval with a non-zero StackID (B), where B < A, then we resize All/UsedColors to size < A + 1, and lose the BitVector associated with A. AFAIK this is a latent bug upstream, but when adding a new TargetStackID locally I hit a `NextColors[StackID] != -1 && "No more spill slots?"` assertion due to this issue.
…lvm#138140) In InitializeSlots, if an interval with a non-zero StackID (A) is encountered we set All/UsedColors to a size of A + 1. If after this we process another interval with a non-zero StackID (B), where B < A, then we resize All/UsedColors to size < A + 1, and lose the BitVector associated with A. AFAIK this is a latent bug upstream, but when adding a new TargetStackID locally I hit a `NextColors[StackID] != -1 && "No more spill slots?"` assertion due to this issue.
…lvm#138140) In InitializeSlots, if an interval with a non-zero StackID (A) is encountered we set All/UsedColors to a size of A + 1. If after this we process another interval with a non-zero StackID (B), where B < A, then we resize All/UsedColors to size < A + 1, and lose the BitVector associated with A. AFAIK this is a latent bug upstream, but when adding a new TargetStackID locally I hit a `NextColors[StackID] != -1 && "No more spill slots?"` assertion due to this issue.
…lvm#138140) In InitializeSlots, if an interval with a non-zero StackID (A) is encountered we set All/UsedColors to a size of A + 1. If after this we process another interval with a non-zero StackID (B), where B < A, then we resize All/UsedColors to size < A + 1, and lose the BitVector associated with A. AFAIK this is a latent bug upstream, but when adding a new TargetStackID locally I hit a `NextColors[StackID] != -1 && "No more spill slots?"` assertion due to this issue.
In InitializeSlots, if an interval with a non-zero StackID (A) is encountered we set All/UsedColors to a size of A + 1. If after this we process another interval with a non-zero StackID (B), where B < A, then we resize All/UsedColors to size < A + 1, and lose the BitVector associated with A.
AFAIK this is a latent bug upstream, but when adding a new TargetStackID locally I hit a
NextColors[StackID] != -1 && "No more spill slots?"
assertion due to this issue.