summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_checker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/graph_checker.cc')
-rw-r--r--compiler/optimizing/graph_checker.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc
index 09a3ae431f..7c3c2bf03d 100644
--- a/compiler/optimizing/graph_checker.cc
+++ b/compiler/optimizing/graph_checker.cc
@@ -80,8 +80,7 @@ void GraphChecker::VisitBasicBlock(HBasicBlock* block) {
}
// Ensure `block` ends with a branch instruction.
- HInstruction* last_inst = block->GetLastInstruction();
- if (last_inst == nullptr || !last_inst->IsControlFlow()) {
+ if (!block->EndsWithControlFlowInstruction()) {
AddError(StringPrintf("Block %d does not end with a branch instruction.",
block->GetBlockId()));
}
@@ -476,4 +475,15 @@ void SSAChecker::VisitBinaryOperation(HBinaryOperation* op) {
}
}
+void SSAChecker::VisitConstant(HConstant* instruction) {
+ HBasicBlock* block = instruction->GetBlock();
+ if (!block->IsEntryBlock()) {
+ AddError(StringPrintf(
+ "%s %d should be in the entry block but is in block %d.",
+ instruction->DebugName(),
+ instruction->GetId(),
+ block->GetBlockId()));
+ }
+}
+
} // namespace art