This is a fix for https://github.com/llvm/llvm-project/issues/55827.
When register we are trying to re-color is split the original register (we tried to recover)
has no uses after the split. However in rollback actions we assign back physical register to it.
Later it causes different assertions. One of them is in attached test.
This CL fixes this by avoiding assigning physical register back to register which has no usage
or its live interval now is empty.
There are alternative solution:
- Disable split in last chance re-coloring as soon as it always leads to rollback.
- Replace register we are re-coloring with registers it was split to.
- Move even further, (2) plus try to color split registers again.
This solution was chosen is less intrusive and fixes functional bug.
The possibility for splitting during last chance recoloring confused me when I was last looking at this here. Is it a problem that the split was also not rolled back as well?