Chromium Code Reviews| Index: src/compiler/register-allocator.cc |
| diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc |
| index da7743ccfb4bfb061ab8fff8a305749ee9c1a720..72b26dbc4b32dba8955487084d7465d0b8f0be18 100644 |
| --- a/src/compiler/register-allocator.cc |
| +++ b/src/compiler/register-allocator.cc |
| @@ -2184,23 +2184,21 @@ void LiveRangeBuilder::ProcessPhis(const InstructionBlock* block, |
| // block. |
| int phi_vreg = phi->virtual_register(); |
| live->Remove(phi_vreg); |
| - InstructionOperand* hint = nullptr; |
| + // Select the hint from the first predecessor block that preceeds this block |
| + // in the rpo ordering. Prefer non-deferred blocks. |
|
Mircea Trofin
2016/06/01 15:02:58
Could you add a comment as to why the rpo ordering
danno
2016/06/02 01:29:37
Done.
Mircea Trofin
2016/06/02 01:42:43
(nit, sorry) what's the motivation, though? Why do
danno
2016/06/02 13:17:06
Whoops, lost the edit. Updated the comment in a la
|
| + const Instruction* instr = nullptr; |
| const InstructionBlock::Predecessors& predecessors = block->predecessors(); |
| - const InstructionBlock* predecessor_block = |
| - code()->InstructionBlockAt(predecessors[0]); |
| - const Instruction* instr = GetLastInstruction(code(), predecessor_block); |
| - if (predecessor_block->IsDeferred()) { |
| - // "Prefer the hint from the first non-deferred predecessor, if any. |
| - for (size_t i = 1; i < predecessors.size(); ++i) { |
| - predecessor_block = code()->InstructionBlockAt(predecessors[i]); |
| - if (!predecessor_block->IsDeferred()) { |
| - instr = GetLastInstruction(code(), predecessor_block); |
| - break; |
| - } |
| + for (size_t i = 0; i < predecessors.size(); ++i) { |
| + const InstructionBlock* predecessor_block = |
| + code()->InstructionBlockAt(predecessors[i]); |
| + if (predecessor_block->rpo_number() < block->rpo_number()) { |
| + instr = GetLastInstruction(code(), predecessor_block); |
| + if (!predecessor_block->IsDeferred()) break; |
|
Mircea Trofin
2016/06/01 15:02:58
Before, if the phi block was deferred, and all its
danno
2016/06/02 01:29:37
Hmmm. Sorry, perhaps I'm missing something here, b
Mircea Trofin
2016/06/02 01:39:51
Oh! You are right, sorry. I now see instr is alway
|
| } |
| } |
| DCHECK_NOT_NULL(instr); |
| + InstructionOperand* hint = nullptr; |
| for (MoveOperands* move : *instr->GetParallelMove(Instruction::END)) { |
| InstructionOperand& to = move->destination(); |
| if (to.IsUnallocated() && |