diff options
author | Alon Zakai <azakai@google.com> | 2021-11-11 11:24:44 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-11 11:24:44 -0800 |
commit | 50e66800dc28d67ea1cc88172f459df1ca96507d (patch) | |
tree | d4a42612823b3ba0f986d349288bfa3fa1671a1f /src/passes/ReorderFunctions.cpp | |
parent | a113d39fe87e098c5b19ca75002b6995a3f69e3e (diff) | |
download | binaryen-50e66800dc28d67ea1cc88172f459df1ca96507d.tar.gz binaryen-50e66800dc28d67ea1cc88172f459df1ca96507d.tar.bz2 binaryen-50e66800dc28d67ea1cc88172f459df1ca96507d.zip |
DeadArgumentElimination argument subtyping: Add fixups if the param is used (#4319)
Before, if we saw a param is written, that prevented us from subtyping it:
function foo(x : oldType) {
..
x = someValue;
..
}
Even if all calls to foo send some specific struct type that we'd like to subtype
to, seeing that write stopped us. To handle such a write we need to do some
extra handling for the case in which it is written a less-specific type (that is,
if someValue is of type oldType, something like this:
function foo(x : newType) {
var x_old : oldType;
x_old = x; // copy the param to x_old, and use x_old everywhere
..
x_old = someValue;
..
}
That is, still refine the param type, but inside the function use a new local that
has the old type, and is guaranteed to validate. This PR implements that logic
so that we can optimize more cases.
To allow that, this PR avoids trying to both refine a type and remove a param as
being unused - that has annoying corner cases. If it is unused, we can simply
remove it anyhow.
Diffstat (limited to 'src/passes/ReorderFunctions.cpp')
0 files changed, 0 insertions, 0 deletions