diff options
author | Alon Zakai <azakai@google.com> | 2021-09-10 15:35:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-10 22:35:29 +0000 |
commit | fc310a6dd6145d5d1470d8bf4cbb57c93f8785f1 (patch) | |
tree | bd611524aea65aab2652eb4e122438166d871ce9 /test/lit/help/optimization-opts.test | |
parent | ea74b4f8649dfa6c8775fcef829d115083e5acc9 (diff) | |
download | binaryen-fc310a6dd6145d5d1470d8bf4cbb57c93f8785f1.tar.gz binaryen-fc310a6dd6145d5d1470d8bf4cbb57c93f8785f1.tar.bz2 binaryen-fc310a6dd6145d5d1470d8bf4cbb57c93f8785f1.zip |
Add an Intrinsics mechanism, and a call.without.effects intrinsic (#4126)
An "intrinsic" is modeled as a call to an import. We could also add new
IR things for them, but that would take more work and lead to less
clear errors in other tools if they try to read a binary using such a
nonstandard extension.
A first intrinsic is added here, call.without.effects This is basically the same
as call_ref except that the optimizer is free to assume the call has no
side effects. Consequently, if the result is not used then it can be optimized
out (as even if it is not used then side effects could have kept it around).
Likewise, the lack of side effects allows more reordering and other
things.
A lowering pass for intrinsics is provided. Rather than automatically
lower them to normal wasm at the end of optimizations, the user must
call that pass explicitly. A typical workflow might be
-O --intrinsic-lowering -O
That optimizes with the intrinsic present - perhaps removing calls
thanks to it - then lowers it into normal wasm - it turns into a call_ref -
and then optimizes further, which would turns the call_ref into a
direct call, potentially inline, etc.
Diffstat (limited to 'test/lit/help/optimization-opts.test')
-rw-r--r-- | test/lit/help/optimization-opts.test | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/lit/help/optimization-opts.test b/test/lit/help/optimization-opts.test index 18f8970c2..177a1b620 100644 --- a/test/lit/help/optimization-opts.test +++ b/test/lit/help/optimization-opts.test @@ -284,6 +284,8 @@ ;; CHECK-NEXT: to intercept all loads and ;; CHECK-NEXT: stores ;; CHECK-NEXT: +;; CHECK-NEXT: --intrinsic-lowering lower away binaryen intrinsics +;; CHECK-NEXT: ;; CHECK-NEXT: --legalize-js-interface legalizes i64 types on the ;; CHECK-NEXT: import/export boundary ;; CHECK-NEXT: |