summaryrefslogtreecommitdiff
path: root/test/lit/passes/monomorphize-consts.wast
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-08-14 10:45:01 -0700
committerGitHub <noreply@github.com>2024-08-14 10:45:01 -0700
commit39553a0247eb39c2f58c883cd6fb6b7e00f559ad (patch)
tree13a422451627b4011e2963c1b1e6304fa65421f5 /test/lit/passes/monomorphize-consts.wast
parent0c84afe87ea67239c4d7bf885b43b5c4f52322af (diff)
downloadbinaryen-39553a0247eb39c2f58c883cd6fb6b7e00f559ad.tar.gz
binaryen-39553a0247eb39c2f58c883cd6fb6b7e00f559ad.tar.bz2
binaryen-39553a0247eb39c2f58c883cd6fb6b7e00f559ad.zip
Monomorphization: Add a flag to control the required improvement (#6837)
The argument is the minimum benefit we must see for us to decide to optimize, e.g. --monomorphize --pass-arg=monomorphize-min-benefit@50 When the minimum benefit is 50% then if we reduce the cost by 50% through monomorphization then we optimize there. 95% would only optimize when we remove almost all the cost, etc. In practice I see 95% will actually tend to reduce code size overall, as while we add monomorphized versions of functions, we only do so when we remove a lot of work and size, and after inlining we gain benefits. However, 50% or even lower can lead to better benchmark results, in return for larger code size, just like with inlining. To be careful, the default is set to 95%. Previously we optimized whenever we saw any benefit at all, which is the same as requiring a minimum benefit of 0%. Old tests have the flag applied in this PR to set that value, so they do not change.
Diffstat (limited to 'test/lit/passes/monomorphize-consts.wast')
-rw-r--r--test/lit/passes/monomorphize-consts.wast7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/lit/passes/monomorphize-consts.wast b/test/lit/passes/monomorphize-consts.wast
index d71367569..1d18f6dab 100644
--- a/test/lit/passes/monomorphize-consts.wast
+++ b/test/lit/passes/monomorphize-consts.wast
@@ -2,10 +2,11 @@
;; As in monomorphize-types.wast, test in both "always" mode, which always
;; monomorphizes, and in "careful" mode which does it only when it appears to
-;; actually help.
+;; actually help, and use a minimum benefit of 0 to make it easy to write
+;; small testcases.
-;; RUN: foreach %s %t wasm-opt --monomorphize-always -all -S -o - | filecheck %s --check-prefix ALWAYS
-;; RUN: foreach %s %t wasm-opt --monomorphize -all -S -o - | filecheck %s --check-prefix CAREFUL
+;; RUN: foreach %s %t wasm-opt --monomorphize-always -all -S -o - | filecheck %s --check-prefix ALWAYS
+;; RUN: foreach %s %t wasm-opt --monomorphize --pass-arg=monomorphize-min-benefit@0 -all -S -o - | filecheck %s --check-prefix CAREFUL
(module
;; Test that constants are monomorphized.