diff options
author | Alon Zakai <azakai@google.com> | 2024-11-12 09:09:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-12 09:09:33 -0800 |
commit | 52cae1142bb8c06c98c4887ef9ffefff70dbeefc (patch) | |
tree | 869fa579a53ec31a213312387abc756f2d92979a /src/passes/MemoryCopyFillLowering.cpp | |
parent | 67894e4989870807561e6e80ae6e18c1e0e9a4ef (diff) | |
download | binaryen-52cae1142bb8c06c98c4887ef9ffefff70dbeefc.tar.gz binaryen-52cae1142bb8c06c98c4887ef9ffefff70dbeefc.tar.bz2 binaryen-52cae1142bb8c06c98c4887ef9ffefff70dbeefc.zip |
HeapStoreOptimization: Fix a bug with jumping from the later value (v2) (#7070)
This PR fixes this situation:
(block $out
(local.set $x (struct.new X Y Z))
(struct.set $X 0 (local.get $x) (..br $out..)) ;; X' here has a br
)
(local.get $x)
=>
(block $out
(local.set $x (struct.new (..br $out..) Y Z))
)
(local.get $x)
We want to fold the struct.set into the struct.new, but the br is
a problem: if it executes then we skip the struct.set, and the last
local.get in fact reads the struct before the write. And, if we did this
optimization, we'd end up with the br on the struct.new, so it
would skip that instruction and even the local.set.
To fix this, we use the new API from #7039, which lets us query,
"is it ok to move the local.set to where the struct.set is?"
Diffstat (limited to 'src/passes/MemoryCopyFillLowering.cpp')
0 files changed, 0 insertions, 0 deletions