diff options
author | 2018-05-02 16:07:51 -0700 | |
---|---|---|
committer | 2018-05-03 09:26:25 -0700 | |
commit | a8360cd6b858906f20558552f7bf3b3876c72ec4 (patch) | |
tree | 357c6916cb832b9a27ff6bbcf2d9344fb818e569 /compiler/optimizing/graph_checker.cc | |
parent | d637fdac0ea396780b12052c7ab9de61744bcd4b (diff) |
Perform rudimentary check on graph size for no-change assertions.
Rationale:
This will find blatant violations of asserting a no-change
pass change if the graph size changed nevertheless.
Bug: 78171933
Test: test-art-host,target
Change-Id: I07b38e71c75dd6f728246d096976c8333b363329
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; |