Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: runtime/vm/flow_graph_allocator.cc

Issue 11404003: Use structural loop info computed by register allocator to mark loop phis. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_allocator.cc
diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc
index 3bf559698aff1cfbbc5616af293c65471b105745..609d1d68b515ea7ca36d654776086f2ed589ac7b 100644
--- a/runtime/vm/flow_graph_allocator.cc
+++ b/runtime/vm/flow_graph_allocator.cc
@@ -722,43 +722,45 @@ void FlowGraphAllocator::ConnectIncomingPhiMoves(BlockEntryInstr* block) {
const intptr_t pos = join->start_pos();
ZoneGrowableArray<PhiInstr*>* phis = join->phis();
- if (phis != NULL) {
- intptr_t move_idx = 0;
- for (intptr_t phi_idx = 0; phi_idx < phis->length(); phi_idx++) {
- PhiInstr* phi = (*phis)[phi_idx];
- if (phi == NULL) continue;
+ if (phis == NULL) return;
- const intptr_t vreg = phi->ssa_temp_index();
- ASSERT(vreg != -1);
+ const bool is_loop_header = BlockInfoAt(join->start_pos())->is_loop_header();
- // Expected shape of live range:
- //
- // B
- // phi [--------
- //
- LiveRange* range = GetLiveRange(vreg);
- range->DefineAt(pos); // Shorten live range.
-
- if (join->loop_info() != NULL) range->mark_loop_phi();
-
- for (intptr_t pred_idx = 0; pred_idx < phi->InputCount(); pred_idx++) {
- BlockEntryInstr* pred = block->PredecessorAt(pred_idx);
- GotoInstr* goto_instr = pred->last_instruction()->AsGoto();
- ASSERT((goto_instr != NULL) && (goto_instr->HasParallelMove()));
- MoveOperands* move =
- goto_instr->parallel_move()->MoveOperandsAt(move_idx);
- move->set_dest(Location::PrefersRegister());
- range->AddUse(pos, move->dest_slot());
- }
+ intptr_t move_idx = 0;
+ for (intptr_t phi_idx = 0; phi_idx < phis->length(); phi_idx++) {
+ PhiInstr* phi = (*phis)[phi_idx];
+ if (phi == NULL) continue;
- // All phi resolution moves are connected. Phi's live range is
- // complete.
- AssignSafepoints(range);
+ const intptr_t vreg = phi->ssa_temp_index();
+ ASSERT(vreg != -1);
+
+ // Expected shape of live range:
+ //
+ // B
+ // phi [--------
+ //
+ LiveRange* range = GetLiveRange(vreg);
+ range->DefineAt(pos); // Shorten live range.
- CompleteRange(range, RegisterKindForResult(phi));
+ if (is_loop_header) range->mark_loop_phi();
- move_idx++;
+ for (intptr_t pred_idx = 0; pred_idx < phi->InputCount(); pred_idx++) {
+ BlockEntryInstr* pred = block->PredecessorAt(pred_idx);
+ GotoInstr* goto_instr = pred->last_instruction()->AsGoto();
+ ASSERT((goto_instr != NULL) && (goto_instr->HasParallelMove()));
+ MoveOperands* move =
+ goto_instr->parallel_move()->MoveOperandsAt(move_idx);
+ move->set_dest(Location::PrefersRegister());
+ range->AddUse(pos, move->dest_slot());
}
+
+ // All phi resolution moves are connected. Phi's live range is
+ // complete.
+ AssignSafepoints(range);
+
+ CompleteRange(range, RegisterKindForResult(phi));
+
+ move_idx++;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698