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