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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 11962036: Fix a bug with store-to-load forwarding for typed arrays. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 | « no previous file | tests/language/int_array_load_elimination_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
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 17190)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -3239,13 +3239,21 @@
// will ever be used.
gen->RemoveAll(kill_by_offset_[offset_in_words]);
- Definition* load = map_->Lookup(instr->AsDefinition());
- if (load != NULL) {
- // Store has a corresponding numbered load. Try forwarding
- // stored value to it.
- gen->Add(load->expr_id());
- if (out_values == NULL) out_values = CreateBlockOutValues();
- (*out_values)[load->expr_id()] = GetStoredValue(instr);
+ // Only forward stores to normal arrays and float64 arrays
+ // to loads because other array stores (intXX/uintXX/float32)
+ // may implicitly convert the value stored.
+ StoreIndexedInstr* array_store = instr->AsStoreIndexed();
+ if (array_store == NULL ||
+ array_store->class_id() == kArrayCid ||
+ array_store->class_id() == kFloat64ArrayCid) {
+ Definition* load = map_->Lookup(instr->AsDefinition());
+ if (load != NULL) {
+ // Store has a corresponding numbered load. Try forwarding
+ // stored value to it.
+ gen->Add(load->expr_id());
+ if (out_values == NULL) out_values = CreateBlockOutValues();
+ (*out_values)[load->expr_id()] = GetStoredValue(instr);
+ }
}
}
ASSERT(instr->IsDefinition() &&
« no previous file with comments | « no previous file | tests/language/int_array_load_elimination_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698