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

Unified Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10695103: Track users through phi nodes to eliminate '>>> 0' for more bitops (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comment. Created 8 years, 5 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: lib/compiler/implementation/ssa/codegen.dart
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index aa910463227bc4bb204f8aafaab300e65873c138..dd0f2b1ee79ac4370174d972812fad631e0ee86f 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -217,6 +217,20 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
return false;
}
+ bool hasNonBitOpUser(HInstruction instruction, Set<HPhi> phiSet) {
+ for (HInstruction use in instruction.usedBy) {
+ if (use is HPhi) {
+ if (!phiSet.contains(use)) {
+ phiSet.add(use);
+ if (hasNonBitOpUser(use, phiSet)) return true;
+ }
+ } else if (use is! HBitNot && use is! HBinaryBitOp) {
+ return true;
+ }
+ }
+ return false;
+ }
+
// We want the outcome of bit-operations to be positive. However, if
// the result of a bit-operation is only used by other bit
// operations we do not have to convert to an unsigned
@@ -228,14 +242,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
isNonNegativeInt32Constant(instruction.right))) {
return false;
}
- bool result = false;
- for (HInstruction use in instruction.usedBy) {
- if (use is! HBitNot && use is! HBinaryBitOp) {
- result = true;
- break;
- }
- }
- return result;
+ return hasNonBitOpUser(instruction, new Set<HPhi>());
}
SsaCodeGenerator(this.backend,
« 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