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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 22871008: Compensate for the lack of code motion in licm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | tests/compiler/dart2js/licm_test.dart » ('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 part of ssa; 5 part of ssa;
6 6
7 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 } 1033 }
1034 } 1034 }
1035 1035
1036 void moveLoopInvariantCodeFromBlock(HBasicBlock block, 1036 void moveLoopInvariantCodeFromBlock(HBasicBlock block,
1037 HBasicBlock loopHeader, 1037 HBasicBlock loopHeader,
1038 int changesFlags) { 1038 int changesFlags) {
1039 assert(block.parentLoopHeader == loopHeader || block == loopHeader); 1039 assert(block.parentLoopHeader == loopHeader || block == loopHeader);
1040 HBasicBlock preheader = loopHeader.predecessors[0]; 1040 HBasicBlock preheader = loopHeader.predecessors[0];
1041 int dependsFlags = SideEffects.computeDependsOnFlags(changesFlags); 1041 int dependsFlags = SideEffects.computeDependsOnFlags(changesFlags);
1042 HInstruction instruction = block.first; 1042 HInstruction instruction = block.first;
1043 bool firstInstructionInLoop = block == loopHeader; 1043 bool isLoopAlwaysTaken() {
1044 HInstruction instruction = loopHeader.last;
1045 return instruction is HGoto || instruction.inputs[0].isConstantTrue();
1046 }
1047 bool firstInstructionInLoop = block == loopHeader
1048 // Compensate for lack of code motion.
1049 || (blockChangesFlags[loopHeader.id] == 0
1050 && isLoopAlwaysTaken()
1051 && loopHeader.successors[0] == block);
1044 while (instruction != null) { 1052 while (instruction != null) {
1045 HInstruction next = instruction.next; 1053 HInstruction next = instruction.next;
1046 if (instruction.useGvn() 1054 if (instruction.useGvn()
1047 && (!instruction.canThrow() || firstInstructionInLoop) 1055 && (!instruction.canThrow() || firstInstructionInLoop)
1048 && !instruction.sideEffects.dependsOn(dependsFlags)) { 1056 && !instruction.sideEffects.dependsOn(dependsFlags)) {
1049 bool loopInvariantInputs = true; 1057 bool loopInvariantInputs = true;
1050 List<HInstruction> inputs = instruction.inputs; 1058 List<HInstruction> inputs = instruction.inputs;
1051 for (int i = 0, length = inputs.length; i < length; i++) { 1059 for (int i = 0, length = inputs.length; i < length; i++) {
1052 if (isInputDefinedAfterDominator(inputs[i], preheader)) { 1060 if (isInputDefinedAfterDominator(inputs[i], preheader)) {
1053 loopInvariantInputs = false; 1061 loopInvariantInputs = false;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 // that knows it is not of a specific Type. 1347 // that knows it is not of a specific Type.
1340 } 1348 }
1341 1349
1342 for (HIf ifUser in notIfUsers) { 1350 for (HIf ifUser in notIfUsers) {
1343 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); 1351 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType);
1344 // TODO(ngeoffray): Also change uses for the then block on a HType 1352 // TODO(ngeoffray): Also change uses for the then block on a HType
1345 // that knows it is not of a specific Type. 1353 // that knows it is not of a specific Type.
1346 } 1354 }
1347 } 1355 }
1348 } 1356 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/licm_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698