diff options
| author | Quentin Colombet <qcolombet@apple.com> | 2016-09-16 22:00:42 +0000 |
|---|---|---|
| committer | Quentin Colombet <qcolombet@apple.com> | 2016-09-16 22:00:42 +0000 |
| commit | 631768659d02c57402f8f7bd0832a9fb5cdda048 (patch) | |
| tree | 01ff28cfa6ec17f94089c5d021d4f4b7eb4abe8a /llvm/lib/CodeGen/RegAllocGreedy.cpp | |
| parent | bbeb45aff64e888cd7db72ca3dac862c7233490c (diff) | |
| download | bcm5719-llvm-631768659d02c57402f8f7bd0832a9fb5cdda048.tar.gz bcm5719-llvm-631768659d02c57402f8f7bd0832a9fb5cdda048.zip | |
[RegAllocGreedy] Fix an assertion and condition when last chance recoloring is used.
When last chance recoloring is used, the list of NewVRegs may not be
empty when calling selectOrSplitImpl. Indeed, another coloring may have
taken place with splitting/spilling in the same recoloring session.
Relax an assertion to take this into account and adapt a condition to
act as if the NewVRegs were local to this selectOrSplitImpl instance.
Unfortunately I am unable to produce a test case for this, I was only
able to reproduce the conditions on an out-of-tree target.
llvm-svn: 281782
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocGreedy.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocGreedy.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp index 01d0f11bc81..9d1d5c68365 100644 --- a/llvm/lib/CodeGen/RegAllocGreedy.cpp +++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp @@ -2524,7 +2524,7 @@ unsigned RAGreedy::selectOrSplitImpl(LiveInterval &VirtReg, return PhysReg; } - assert(NewVRegs.empty() && "Cannot append to existing NewVRegs"); + assert((NewVRegs.empty() || Depth) && "Cannot append to existing NewVRegs"); // The first time we see a live range, don't try to split or spill. // Wait until the second time, when all smaller ranges have been allocated. @@ -2543,8 +2543,9 @@ unsigned RAGreedy::selectOrSplitImpl(LiveInterval &VirtReg, Depth); // Try splitting VirtReg or interferences. + unsigned NewVRegSizeBefore = NewVRegs.size(); unsigned PhysReg = trySplit(VirtReg, Order, NewVRegs); - if (PhysReg || !NewVRegs.empty()) + if (PhysReg || (NewVRegs.size() - NewVRegSizeBefore)) return PhysReg; // Finally spill VirtReg itself. |

