More tweaks to dce
commitd2a970ffc64c0f5124b1a9e9d93e2709addbdd96
authorMark Williams <mwilliams@fb.com>
Sun, 16 Apr 2017 16:58:45 +0000 (16 09:58 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Sun, 16 Apr 2017 17:11:39 +0000 (16 10:11 -0700)
treeab5b48b3150d26ed75c387091df8805896287445
parentf32c85f36f00f581b3d7b1e820aa00c81a726d8e
More tweaks to dce

Summary:
Currently, if we have an instruction that reads a single value from
the stack, has no side effects, and writes a value to the stack thats
not used, the best we can do is mark it as "dead if its input's
producer is dead". If we have an instruction that reads multiple
values from the stack has no side effects, and writes a value thats
not used, we can't do anything.

This adds a mechanism to solve both issues.

First we allow such an instruction to be replaced by pops of its
inputs; this can be done unconditionally, without knowing whether the
producers of the inputs can be removed.

Second, we add a mechanism to indicate that a stack slot depends on
the one below it. This allows us to mark the inputs of such an
instruction as depending on each other; if all the producers can be
eliminated, we can kill the pops from the first instruction too -
otherwise we just leave them as is.

Reviewed By: ricklavoie

Differential Revision: D4816792

fbshipit-source-id: b61ca884641bfdae665f5e9adfb55471b98c5b72
hphp/hhbbc/dce.cpp