summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/README.md b/README.md
index 236174ceb..37cda5451 100644
--- a/README.md
+++ b/README.md
@@ -147,6 +147,16 @@ There are a few differences between Binaryen IR and the WebAssembly language:
much about this when writing Binaryen passes. For more details see the
`requiresNonNullableLocalFixups()` hook in `pass.h` and the
`LocalStructuralDominance` class.
+ * `br_if` output types are more refined in Binaryen IR: they have the type of
+ the value, when a value flows in. In the wasm spec the type is that of the
+ branch target, which may be less refined. Using the more refined type here
+ ensures that we optimize in the best way possible, using all the type
+ information, but it does mean that some roundtripping operations may look a
+ little different. In particular, when we emit a `br_if` whose type is more
+ refined in Binaryen IR then we emit a cast right after it, so that the
+ output has the right type in the wasm spec. That may cause a few bytes of
+ extra size in rare cases (we avoid this overhead in the common case where
+ the `br_if` value is unused).
* Strings
* Binaryen allows string views (`stringview_wtf16` etc.) to be cast using
`ref.cast`. This simplifies the IR, as it allows `ref.cast` to always be