summaryrefslogtreecommitdiff
path: root/src/ir/local-graph.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-10-24 14:37:52 -0700
committerGitHub <noreply@github.com>2023-10-24 14:37:52 -0700
commitec8220f4aa556ce39145db13eddd84855b11f76c (patch)
treed994013922dcd35e59f043df83899e6325f36102 /src/ir/local-graph.h
parentba04e395508fc3414b952287d7e918d20361087e (diff)
downloadbinaryen-ec8220f4aa556ce39145db13eddd84855b11f76c.tar.gz
binaryen-ec8220f4aa556ce39145db13eddd84855b11f76c.tar.bz2
binaryen-ec8220f4aa556ce39145db13eddd84855b11f76c.zip
Fix unreachable code in LocalGraph by making it imprecise there (#6048)
Followup to #6046 - the fuzzer found we missed handling the case of the entry itself being unreachable, or of an unreachable loop later. Properly identifying unreachable code requires a flow analysis, unfortunately, so this PR gives up on that and instead allows LocalGraph to be imprecise in unreachable code. That avoids adding any overhead, but does mean the IR may be slightly confusing when debugging. It does not have any optimization downsides, however, as it only affects unreachable code. Also add a dump() impl in that file which helps debugging.
Diffstat (limited to 'src/ir/local-graph.h')
-rw-r--r--src/ir/local-graph.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ir/local-graph.h b/src/ir/local-graph.h
index 8cc92d0fd..fd9306d5c 100644
--- a/src/ir/local-graph.h
+++ b/src/ir/local-graph.h
@@ -30,6 +30,14 @@ namespace wasm {
// (see the SSA pass for actually creating new local indexes based
// on this).
//
+// Note that this is not guaranteed to be precise in unreachable code. That is,
+// we do not make the effort to represent the exact sets for each get, and may
+// overestimate them (specifically, we may mark the entry value as possible,
+// even if unreachability prevents that; doing so helps simplify and optimize
+// the code, which we think is worthwhile for the possible annoyance in
+// debugging etc.; and it has no downside for optimization, since unreachable
+// code will be removed anyhow).
+//
struct LocalGraph {
// main API