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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 11824024: Constant propagator should revisit phis when it visits predecessor block. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move code into VisitGoto Created 7 years, 11 months 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 | « runtime/vm/flow_graph_inliner.cc ('k') | tests/language/constant_propagation_phis_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index 358c2122de2b8148f94bfed9f1053675b45390f1..86fa5b4ac5af2cf1eb5ce8866652fc5c34a6fcba 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -3663,15 +3663,7 @@ void ConstantPropagator::VisitGraphEntry(GraphEntryInstr* block) {
void ConstantPropagator::VisitJoinEntry(JoinEntryInstr* block) {
- ZoneGrowableArray<PhiInstr*>* phis = block->phis();
- if (phis != NULL) {
- for (intptr_t phi_idx = 0; phi_idx < phis->length(); ++phi_idx) {
- PhiInstr* phi = (*phis)[phi_idx];
- if (phi == NULL) continue;
- phi->Accept(this);
- }
- }
-
+ // Phis are visited when visiting Goto at a predecessor. See VisitGoto.
for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
it.Current()->Accept(this);
}
@@ -3712,6 +3704,12 @@ void ConstantPropagator::VisitReThrow(ReThrowInstr* instr) {
void ConstantPropagator::VisitGoto(GotoInstr* instr) {
SetReachable(instr->successor());
+
+ // Phi value depends on the reachability of a predecessor. We have
+ // to revisit phis every time a predecessor becomes reachable.
+ for (PhiIterator it(instr->successor()); !it.Done(); it.Advance()) {
+ it.Current()->Accept(this);
+ }
}
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | tests/language/constant_propagation_phis_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698