Chromium Code Reviews| 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..26764a0f03df5d0471adb326b4350e2c3827e2fe 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 hasNonBitOpUsers(HInstruction instruction, Set<HPhi> phiSet) { |
|
kasperl
2012/07/05 08:40:22
Users -> User?
Mads Ager (google)
2012/07/05 08:42:34
Done.
|
| + for (HInstruction use in instruction.usedBy) { |
| + if (use is HPhi) { |
| + if (!phiSet.contains(use)) { |
| + phiSet.add(use); |
| + if (hasNonBitOpUsers(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 hasNonBitOpUsers(instruction, new Set<HPhi>()); |
| } |
| SsaCodeGenerator(this.backend, |