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

Unified Diff: runtime/vm/flow_graph_range_analysis.cc

Issue 556353002: Fix bug in range analysis. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 | « 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_range_analysis.cc
===================================================================
--- runtime/vm/flow_graph_range_analysis.cc (revision 40085)
+++ runtime/vm/flow_graph_range_analysis.cc (working copy)
@@ -1822,6 +1822,13 @@
}
+// A definition dominates a phi if its block dominates the phi's block
+// and the two blocks are different.
+static bool DominatesPhi(BlockEntryInstr* a, BlockEntryInstr* phi_block) {
+ return a->Dominates(phi_block) && (a != phi_block);
Vyacheslav Egorov (Google) 2014/09/10 18:33:41 You reoder (a != phi_block) && ...
+}
+
+
// When assigning range to a phi we must take care to avoid self-reference
// cycles when phi's range depends on the phi itself.
// To prevent such cases we impose additional restriction on symbols that
@@ -1830,14 +1837,14 @@
static RangeBoundary EnsureAcyclicSymbol(BlockEntryInstr* phi_block,
const RangeBoundary& a,
const RangeBoundary& limit) {
- if (!a.IsSymbol() || a.symbol()->GetBlock()->Dominates(phi_block)) {
+ if (!a.IsSymbol() || DominatesPhi(a.symbol()->GetBlock(), phi_block)) {
return a;
}
// Symbol does not dominate phi. Try unwrapping constraint and check again.
Definition* unwrapped = UnwrapConstraint(a.symbol());
if ((unwrapped != a.symbol()) &&
- unwrapped->GetBlock()->Dominates(phi_block)) {
+ DominatesPhi(unwrapped->GetBlock(), phi_block)) {
return RangeBoundary::FromDefinition(unwrapped, a.offset());
}
« 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