summaryrefslogtreecommitdiff
path: root/src/ir/module-utils.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-02-03 14:10:46 -0800
committerGitHub <noreply@github.com>2022-02-03 22:10:46 +0000
commit9800178d7cfdb336fb5bac34f0d9844639f3a9cc (patch)
treed196a7447d865a602cb00fa90f745bafd30aacb2 /src/ir/module-utils.cpp
parent4e8b85a8d3953234bbfa490cb1d4f5c32380fb3f (diff)
downloadbinaryen-9800178d7cfdb336fb5bac34f0d9844639f3a9cc.tar.gz
binaryen-9800178d7cfdb336fb5bac34f0d9844639f3a9cc.tar.bz2
binaryen-9800178d7cfdb336fb5bac34f0d9844639f3a9cc.zip
[Wasm GC] Fix TypeRefining corner case with uncreated types (#4500)
This pass ignores reads from structs - it only cares about writes (during a create or a struct.set). That makes sense since we want to refine the type of fields to more specific things based on what is actually written to them. However, a corner case was missed: If we ignore reads, the pass may "cleverly" optimize to something that is no longer valid to read from. How that happens is if there is no info at all for a type - no sets or news, so all we have is a read, which as mentioned before we ignore, so we think we have nothing at all for that type, and can do arbitrary stuff with it. But then the arbitrary replacement can be invalid to read from, say if it has fewer fields. To handle that, just emit an unreachable. If all we have is a get but no new then there cannot be an instance here at all. (That's only true in a closed world, of course, but this entire pass assumes that anyhow.)
Diffstat (limited to 'src/ir/module-utils.cpp')
0 files changed, 0 insertions, 0 deletions