Index: src/compiler/instruction.cc |
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc |
index 1b787c1cef0a640a3fd7c36944ac334a19afbcd1..a9ff897a389dd4eabc2fe80f1b874773c2862d0d 100644 |
--- a/src/compiler/instruction.cc |
+++ b/src/compiler/instruction.cc |
@@ -615,6 +615,20 @@ InstructionBlocks* InstructionSequence::InstructionBlocksFor( |
return blocks; |
} |
+void InstructionSequence::Validate() { |
+ // Validate blocks are in edge-split form: no block with multiple successors |
+ // has an edge to a block (== a successor) with more than one predecessors. |
+ for (const InstructionBlock* block : instruction_blocks()) { |
+ if (block->SuccessorCount() > 1) { |
+ for (const RpoNumber& successor_id : block->successors()) { |
+ const InstructionBlock* successor = InstructionBlockAt(successor_id); |
+ // Expect precisely one predecessor: "block". |
+ CHECK(successor->PredecessorCount() == 1 && |
+ successor->predecessors()[0] == block->rpo_number()); |
+ } |
+ } |
+ } |
+} |
void InstructionSequence::ComputeAssemblyOrder(InstructionBlocks* blocks) { |
int ao = 0; |