I thought I fixed this in r308673, but that fix was
very broken. The assumption that any frame index can be used
in place of another was more widespread than I realized.
Even when stack slot sharing was disabled, this was still
replacing frame index uses with a different ID with a different
stack slot.
Really fix this by doing the coloring per-stack ID, so all of
the coloring logically done in a separate namespace. This is a lot
simpler than trying to figure out how to change the color if
the stack ID is different.
As you pointed out, my review D48416 tries to fix the same problems.
Color is now per-StackID, right? But the color is used as the new frame index and written back to the operands. So how does this assert, or the assert at AMDGPU/SIFrameLowering.cpp:694, or anything that uses the new frame index (the color) to index into MFI->StackObjects, work now?