• bmeurer's avatar
    [turbofan] Fix overly aggressive dead code elimination. · 32346aae
    bmeurer authored
    When we eliminate nodes during truncation analysis that have no value
    uses, we must make sure that we do not eliminate speculative number
    operations that would have side effects depending on the inputs, i.e.
    for example a SpeculativeNumberMultiply(x,y) does ToNumber(x) and
    ToNumber(y) first, so if either x or y could throw an exception during
    ToNumber conversion, we must not eliminate the multiplication, even if
    it has no value uses (some later pass may kill the actual machine
    multiplication, but the checks on the inputs have to remain still).
    So we check whether both x and y are PlainPrimitive, i.e. neither
    Receiver nor Symbol, which could raise exceptions for ToNumber, and
    only in that case we propagate the "unusedness" of the node to its
    inputs.
    
    This also uncovered a bug with the type of Dead, which must be None,
    as this represents an impossible value, so we had to fix that too.
    
    Also the dead code removal will not work correctly for constants (i.e.
    pure nodes with no value inputs), as those might be cached and hence
    we might resurrect them for an unrelated node lowering during
    SimplifiedLowering and only later kill the actual node (replacing its
    uses with Dead), which would then also replace the new use with Dead.
    So that was fixed as well. This shouldn't change anything for the
    result, as unused constants automagically disappear from the graph later
    on anyways.
    
    R=yangguo@chromium.org
    BUG=chromium:631318
    
    Review-Url: https://codereview.chromium.org/2182003002
    Cr-Commit-Position: refs/heads/master@{#38038}
    32346aae
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
docs Loading commit data...
gni Loading commit data...
gypfiles Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party/binutils Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
Makefile Loading commit data...
Makefile.android Loading commit data...
Makefile.nacl Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...