diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-08-20 15:46:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-20 15:46:59 -0700 |
commit | 57328f8e1e4db509b9956b53dd5300fc49e424eb (patch) | |
tree | 564cd0cf3ea0345468e252f740f79ff2398aa379 /src/passes/DataFlowOpts.cpp | |
parent | fb578443a44cf400aadd2b0b1354f9da70bc08b9 (diff) | |
download | binaryen-57328f8e1e4db509b9956b53dd5300fc49e424eb.tar.gz binaryen-57328f8e1e4db509b9956b53dd5300fc49e424eb.tar.bz2 binaryen-57328f8e1e4db509b9956b53dd5300fc49e424eb.zip |
Fix value flowing in remove-unused-brs (#1639)
The fuzzer found a bug with flowing of values in that pass: when one arm of an if is none-typed, we can't flow a value through the other. Odd the fuzzer didn't find this earlier, as it's been a bug since the pass was written years ago, but in practice it seems you need a specific set of circumstances on the outside for it to be hit.
The fix is to stop flowing a value in that case. Also, I realized after fixing it that the valueCanFlow global state variable is entirely unneeded. Removing it makes the pass significantly simpler: at all times, flows contains branches and values that might be flowing, and if the flow stops we remove them, etc. - we don't need an extra state variable to say if flowing is possible. So when we want to use the flows, we just check what is there (and then for a flowing branch we can remove it, and for a flowing value we can replace the branch with the value, etc., as in both cases they flow to the right place anyhow).
Diffstat (limited to 'src/passes/DataFlowOpts.cpp')
0 files changed, 0 insertions, 0 deletions