217e265b02
In the current compiler pipeline, PushArgument instructions can end up outliving the calls to which they are an argument in some circumstances. For example, the PushArgument is left in the graph if it also appears in the environments of interleaving instructions. When the dead code eliminator calculates liveness of a definition, it ignores appearances in PushArgument instructions. Instead, it looks for uses of the definition either directly or via PushArgument in the arguments of calls and environments of other instructions in the graph. An separate pass run before DCE removes environments from instructions, so a definition used only in PushArguments that have outlived their calls is considered dead. The current DCE removes dead definitions but leaves PushArgument instructions be. For orphaned PushArguments of dead definitions, this means after DCE they now reference definitions no longer in the graph. This change instead checks the definitions referenced by PushArgument instructions for liveness. If a PushArgument references a dead definition, then the DCE removes the PushArgument instruction, as its call must have already been removed (else the definition would still be live), and environments, and thus environmental uses, have already been removed from the graph. Bug: https://github.com/dart-lang/sdk/issues/39767 Change-Id: I74c8e92a0d93f2aae42f8ff6f06ee70899b2f794 Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128403 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Teagan Strickland <sstrickl@google.com>