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

Unified Diff: runtime/vm/flow_graph.cc

Issue 2709093003: Fixup redefinitions before doing code motion (Closed)
Patch Set: fix build Created 3 years, 10 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.h ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph.cc
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
index 16ed1ebacf2ba492cc0366c771511fe4e3790cf0..92c75ac3f2f97f5e7a6754d2b35dc5ee02d4fb3d 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -483,10 +483,40 @@ bool FlowGraph::VerifyUseLists() {
VerifyUseListsInInstruction(it.Current());
}
}
+
return true; // Return true so we can ASSERT validation.
}
+// Verify that a redefinition dominates all uses of the redefined value.
+bool FlowGraph::VerifyRedefinitions() {
+ for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done();
+ block_it.Advance()) {
+ for (ForwardInstructionIterator instr_it(block_it.Current());
+ !instr_it.Done(); instr_it.Advance()) {
+ RedefinitionInstr* redefinition = instr_it.Current()->AsRedefinition();
+ if (redefinition != NULL) {
+ Definition* original = redefinition->value()->definition();
+ for (Value::Iterator it(original->input_use_list()); !it.Done();
+ it.Advance()) {
+ Value* original_use = it.Current();
+ if (original_use->instruction() == redefinition) {
+ continue;
+ }
+ if (original_use->instruction()->IsDominatedBy(redefinition)) {
+ FlowGraphPrinter::PrintGraph("VerifyRedefinitions", this);
+ THR_Print("%s\n", redefinition->ToCString());
+ THR_Print("use=%s\n", original_use->instruction()->ToCString());
+ return false;
+ }
+ }
+ }
+ }
+ }
+ return true;
+}
+
+
LivenessAnalysis::LivenessAnalysis(
intptr_t variable_count,
const GrowableArray<BlockEntryInstr*>& postorder)
@@ -2096,6 +2126,21 @@ void FlowGraph::RenameDominatedUses(Definition* def,
}
+void FlowGraph::RenameUsesDominatedByRedefinitions() {
+ for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done();
+ block_it.Advance()) {
+ for (ForwardInstructionIterator instr_it(block_it.Current());
+ !instr_it.Done(); instr_it.Advance()) {
+ RedefinitionInstr* redefinition = instr_it.Current()->AsRedefinition();
+ if (redefinition != NULL) {
+ Definition* original = redefinition->value()->definition();
+ RenameDominatedUses(original, redefinition, redefinition);
+ }
+ }
+ }
+}
+
+
static bool IsPositiveOrZeroSmiConst(Definition* d) {
ConstantInstr* const_instr = d->AsConstant();
if ((const_instr != NULL) && (const_instr->value().IsSmi())) {
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698