diff options
author | 2018-05-03 18:49:04 +0000 | |
---|---|---|
committer | 2018-05-03 18:49:04 +0000 | |
commit | 28c9c4764810fb7d92ebc78824f772529e7f8989 (patch) | |
tree | a4b7f9a8d6252fe4f94287edb5340d0f63997886 /compiler/optimizing/graph_checker.cc | |
parent | 8bf3b263d30415ae2d6ddfea9e2178ee760f2da9 (diff) | |
parent | a8360cd6b858906f20558552f7bf3b3876c72ec4 (diff) |
Merge "Perform rudimentary check on graph size for no-change assertions."
Diffstat (limited to 'compiler/optimizing/graph_checker.cc')
-rw-r--r-- | compiler/optimizing/graph_checker.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc index fbcbe3608e..a689f35e0f 100644 --- a/compiler/optimizing/graph_checker.cc +++ b/compiler/optimizing/graph_checker.cc @@ -58,6 +58,30 @@ static bool IsExitTryBoundaryIntoExitBlock(HBasicBlock* block) { !boundary->IsEntry(); } + +size_t GraphChecker::Run(bool pass_change, size_t last_size) { + size_t current_size = GetGraph()->GetReversePostOrder().size(); + if (!pass_change) { + // Nothing changed for certain. Do a quick sanity check on that assertion + // for anything other than the first call (when last size was still 0). + if (last_size != 0) { + if (current_size != last_size) { + AddError(StringPrintf("Incorrect no-change assertion, " + "last graph size %zu vs current graph size %zu", + last_size, current_size)); + } + } + // TODO: if we would trust the "false" value of the flag completely, we + // could skip checking the graph at this point. + } + + // VisitReversePostOrder is used instead of VisitInsertionOrder, + // as the latter might visit dead blocks removed by the dominator + // computation. + VisitReversePostOrder(); + return current_size; +} + void GraphChecker::VisitBasicBlock(HBasicBlock* block) { current_block_ = block; |