Skip to content

Commit 755686e

Browse files
askeksacommit-bot@chromium.org
authored andcommitted
[vm] Simplify RemoveRedefinitions.
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 <[email protected]> Commit-Queue: Aske Simon Christensen <[email protected]>
1 parent 68ede60 commit 755686e

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

runtime/vm/compiler/backend/flow_graph.cc

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,21 +1669,12 @@ void FlowGraph::RemoveRedefinitions(bool keep_checks) {
16691669
instr_it.RemoveCurrentFromGraph();
16701670
} else if (keep_checks) {
16711671
continue;
1672-
} else if (auto check = instruction->AsCheckArrayBound()) {
1673-
check->ReplaceUsesWith(check->index()->definition());
1674-
check->ClearSSATempIndex();
1675-
} else if (auto check = instruction->AsGenericCheckBound()) {
1676-
check->ReplaceUsesWith(check->index()->definition());
1677-
check->ClearSSATempIndex();
1678-
} else if (auto check = instruction->AsCheckNull()) {
1679-
check->ReplaceUsesWith(check->value()->definition());
1680-
check->ClearSSATempIndex();
1681-
} else if (auto check = instruction->AsAssertAssignable()) {
1682-
check->ReplaceUsesWith(check->value()->definition());
1683-
check->ClearSSATempIndex();
1684-
} else if (auto check = instruction->AsAssertBoolean()) {
1685-
check->ReplaceUsesWith(check->value()->definition());
1686-
check->ClearSSATempIndex();
1672+
} else if (auto def = instruction->AsDefinition()) {
1673+
Value* value = def->RedefinedValue();
1674+
if (value != nullptr) {
1675+
def->ReplaceUsesWith(value->definition());
1676+
def->ClearSSATempIndex();
1677+
}
16871678
}
16881679
}
16891680
}

0 commit comments

Comments
 (0)