Skip to content

Commit

Permalink
[vm] Simplify RemoveRedefinitions.
Browse files Browse the repository at this point in the history
Instead of having identical cases for every instruction that implements
RedefinedValue, just have one generic piece of code.

Change-Id: If3f4905a578eb345ae3d740d1f539d346c6223af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150985
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
  • Loading branch information
askeksa authored and commit-bot@chromium.org committed Jun 15, 2020
1 parent 68ede60 commit 755686e
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions runtime/vm/compiler/backend/flow_graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1669,21 +1669,12 @@ void FlowGraph::RemoveRedefinitions(bool keep_checks) {
instr_it.RemoveCurrentFromGraph();
} else if (keep_checks) {
continue;
} else if (auto check = instruction->AsCheckArrayBound()) {
check->ReplaceUsesWith(check->index()->definition());
check->ClearSSATempIndex();
} else if (auto check = instruction->AsGenericCheckBound()) {
check->ReplaceUsesWith(check->index()->definition());
check->ClearSSATempIndex();
} else if (auto check = instruction->AsCheckNull()) {
check->ReplaceUsesWith(check->value()->definition());
check->ClearSSATempIndex();
} else if (auto check = instruction->AsAssertAssignable()) {
check->ReplaceUsesWith(check->value()->definition());
check->ClearSSATempIndex();
} else if (auto check = instruction->AsAssertBoolean()) {
check->ReplaceUsesWith(check->value()->definition());
check->ClearSSATempIndex();
} else if (auto def = instruction->AsDefinition()) {
Value* value = def->RedefinedValue();
if (value != nullptr) {
def->ReplaceUsesWith(value->definition());
def->ClearSSATempIndex();
}
}
}
}
Expand Down

0 comments on commit 755686e

Please sign in to comment.