Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ssa/validate.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/validate.dart b/sdk/lib/_internal/compiler/implementation/ssa/validate.dart |
| index e751b4dcce6c206f6edc371e919fe2656978e10c..2858204ebe1acdd57b667c09be7483ac98c7387c 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/validate.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/validate.dart |
| @@ -36,7 +36,16 @@ class HValidator extends HInstructionVisitor { |
| markInvalid("If node without two successors"); |
| } |
| if (block.last is HConditionalBranch && block.successors.length != 2) { |
| - markInvalid("Conditional node without two successors"); |
| + markInvalid("Conditional node without two successors"); |
| + } |
| + if (block.last is HLoopBranch) { |
| + // Assert that the block we inserted to avoid critical edges satisfies |
| + // our assumptions. That is, it must not contain any instructions |
| + // (although it may contain phi-updates). |
| + HBasicBlock avoidCriticalEdgeBlock = block.successors.last; |
| + if (avoidCriticalEdgeBlock.first is! HGoto) { |
| + markInvalid("Critical edge block contains instructions"); |
| + } |
| } |
| if (block.last is HGoto && block.successors.length != 1) { |
| markInvalid("Goto node with not exactly one successor"); |
| @@ -67,6 +76,17 @@ class HValidator extends HInstructionVisitor { |
| markInvalid("successor with lower id, but not a loop-header"); |
| } |
| } |
| + // Make sure we don't have a critical edge. |
| + if (isValid && block.successors.length > 1 && |
| + block.last is! HTry && block.last is! HExitTry && |
| + block.last is! HSwitch) { |
|
ngeoffray
2014/06/25 07:55:22
Wow, did not realize there was that many special c
floitsch
2014/06/25 08:27:18
Didn't know either, until all kinds of tests bombe
|
| + for (HBasicBlock successor in block.successors) { |
| + if (!isValid) break; |
| + if (successor.predecessors.length >= 2) { |
| + markInvalid("SSA graph contains critical edge."); |
| + } |
| + } |
| + } |
| // Check that the entries in the dominated-list are sorted. |
| int lastId = 0; |