[vm/compiler] Fix missing incremental DOM update

Rationale:
Found by the new graph checker! Dominance relation was
not complete after incremental update (note that most
passes get around this by just recomputing the full
relation). Graph checkers are very useful to find
such omissions.
Change-Id: I4f2c8bfaee54b7a092aaaec04886635c86b451fa
Reviewed-on: https://dart-review.googlesource.com/c/91244
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Aart Bik 2019-01-28 18:08:47 +00:00 committed by commit-bot@chromium.org
parent 95b017a888
commit 2881a92c4e

View file

@ -3437,20 +3437,25 @@ bool FlowGraphInliner::TryReplaceStaticCallWithInline(
entry->UnuseAllInputs(); // Entry block is not in the graph.
if (last != NULL) {
BlockEntryInstr* link = call->GetBlock();
Instruction* exit = last->GetBlock();
BlockEntryInstr* exit = last->GetBlock();
if (link != exit) {
// Dominance relation and SSA are updated incrementally when
// conditionals are inserted. But succ/pred and ordering needs
// to be redone. TODO(ajcbik): do this incrementally too.
for (intptr_t i = 0, n = link->dominated_blocks().length(); i < n;
++i) {
exit->AddDominatedBlock(link->dominated_blocks()[i]);
}
link->ClearDominatedBlocks();
for (intptr_t i = 0, n = entry->dominated_blocks().length(); i < n;
++i) {
link->AddDominatedBlock(entry->dominated_blocks()[i]);
}
while (exit->next()) {
exit = exit->next();
Instruction* scan = exit;
while (scan->next() != nullptr) {
scan = scan->next();
}
exit->LinkTo(call);
scan->LinkTo(call);
flow_graph->DiscoverBlocks();
} else {
last->LinkTo(call);