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

Side by Side Diff: runtime/vm/compiler.cc

Issue 143263010: Implement simple dead store elimination. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if (DominatorBasedCSE::Optimize(flow_graph)) { 431 if (DominatorBasedCSE::Optimize(flow_graph)) {
432 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 432 DEBUG_ASSERT(flow_graph->VerifyUseLists());
433 // Do another round of CSE to take secondary effects into account: 433 // Do another round of CSE to take secondary effects into account:
434 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) 434 // e.g. when eliminating dependent loads (a.x[0] + a.x[0])
435 // TODO(fschneider): Change to a one-pass optimization pass. 435 // TODO(fschneider): Change to a one-pass optimization pass.
436 DominatorBasedCSE::Optimize(flow_graph); 436 DominatorBasedCSE::Optimize(flow_graph);
437 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 437 DEBUG_ASSERT(flow_graph->VerifyUseLists());
438 } 438 }
439 } 439 }
440 440
441 // Optimize (a << b) & c patterns, merge operations. 441 // Run loop-invariant code motion right after load elimination since it
442 // Run after CSE in order to have more opportunity to merge 442 // depends on the numbering of loads from the previous load-elimination.
443 // instructions that have same inputs.
444 optimizer.TryOptimizePatterns();
445 DEBUG_ASSERT(flow_graph->VerifyUseLists());
446
447 if (FLAG_loop_invariant_code_motion) { 443 if (FLAG_loop_invariant_code_motion) {
448 LICM licm(flow_graph); 444 LICM licm(flow_graph);
449 licm.Optimize(); 445 licm.Optimize();
450 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 446 DEBUG_ASSERT(flow_graph->VerifyUseLists());
451 } 447 }
452 flow_graph->RemoveRedefinitions(); 448 flow_graph->RemoveRedefinitions();
453 449
450 // Optimize (a << b) & c patterns, merge operations.
451 // Run after CSE in order to have more opportunity to merge
452 // instructions that have same inputs.
453 optimizer.TryOptimizePatterns();
454 DEBUG_ASSERT(flow_graph->VerifyUseLists());
455
456 DeadStoreElimination::Optimize(flow_graph);
457
454 if (FLAG_range_analysis) { 458 if (FLAG_range_analysis) {
455 // Propagate types after store-load-forwarding. Some phis may have 459 // Propagate types after store-load-forwarding. Some phis may have
456 // become smi phis that can be processed by range analysis. 460 // become smi phis that can be processed by range analysis.
457 FlowGraphTypePropagator::Propagate(flow_graph); 461 FlowGraphTypePropagator::Propagate(flow_graph);
458 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 462 DEBUG_ASSERT(flow_graph->VerifyUseLists());
459 463
460 // We have to perform range analysis after LICM because it 464 // We have to perform range analysis after LICM because it
461 // optimistically moves CheckSmi through phis into loop preheaders 465 // optimistically moves CheckSmi through phis into loop preheaders
462 // making some phis smi. 466 // making some phis smi.
463 optimizer.InferSmiRanges(); 467 optimizer.InferSmiRanges();
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 const Object& result = 967 const Object& result =
964 Object::Handle(isolate->object_store()->sticky_error()); 968 Object::Handle(isolate->object_store()->sticky_error());
965 isolate->object_store()->clear_sticky_error(); 969 isolate->object_store()->clear_sticky_error();
966 return result.raw(); 970 return result.raw();
967 } 971 }
968 UNREACHABLE(); 972 UNREACHABLE();
969 return Object::null(); 973 return Object::null();
970 } 974 }
971 975
972 } // namespace dart 976 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698