diff options
author | Bruce He <44327446+zm2he@users.noreply.github.com> | 2023-06-06 16:11:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-06 20:11:38 +0000 |
commit | 7b093e8d0cfe09471aed4eb40c093f0603f11efb (patch) | |
tree | 298dba196da4c5be133dae14f5c13f6ac32b1b87 /src/shared-constants.h | |
parent | 90f471ded4f9cdacb630197d192da93f56d01ee9 (diff) | |
download | binaryen-7b093e8d0cfe09471aed4eb40c093f0603f11efb.tar.gz binaryen-7b093e8d0cfe09471aed4eb40c093f0603f11efb.tar.bz2 binaryen-7b093e8d0cfe09471aed4eb40c093f0603f11efb.zip |
Move casts which are immediate children of local.gets to earlier local.gets (#5744)
In the OptimizeCasts pass, it is useful to move more refined casts as early as
possible without causing side-effects. This will allow such casts to potentially
trap earlier, and will allow the OptimizeCasts pass to use more refined casts
earlier. This change allows a more refined cast to be duplicated at an earlier
local.get expression. The later instance of the cast will then be eliminated in
a later optimization pass.
For example, if we have the following instructions:
(drop
(local.get $x)
)
(drop
(ref.cast $A
(local.get $x)
)
(drop
(ref.cast $B
(local.get $x)
)
)
Where $B is a sublcass of $A, we can convert this to:
(drop
(ref.cast $B
(local.get $x)
)
)
(drop
(ref.cast $A
(local.get $x)
)
(drop
(ref.cast $B
(local.get $x)
)
)
Concretely we will save the first cast to a local and use it in the other
local.gets.
Diffstat (limited to 'src/shared-constants.h')
0 files changed, 0 insertions, 0 deletions