diff options
author | Max Graey <maxgraey@gmail.com> | 2020-11-04 19:06:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 09:06:35 -0800 |
commit | e85122d218aed06e81ecf0279a0da8199a85131b (patch) | |
tree | 4b010d0f73aa4bb17133989b7c52e32d9b747c8d /test | |
parent | 3bf75aa82ef96fd52f47fbe63ebe1c555c9dfcb8 (diff) | |
download | binaryen-e85122d218aed06e81ecf0279a0da8199a85131b.tar.gz binaryen-e85122d218aed06e81ecf0279a0da8199a85131b.tar.bz2 binaryen-e85122d218aed06e81ecf0279a0da8199a85131b.zip |
More precise implicitTrap detection for binary extressions (#3312)
Division and remainder do not have an implicit trap if the
right-hand side is a constant and not one of the dangerous
values there.
Also refactor ignoreImplicitTrap handling for clarity.
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/inlining-optimizing_optimize-level=3.txt | 16 | ||||
-rw-r--r-- | test/passes/remove-unused-brs_shrink-level=1.txt | 4 | ||||
-rw-r--r-- | test/passes/vacuum_all-features.txt | 6 |
3 files changed, 12 insertions, 14 deletions
diff --git a/test/passes/inlining-optimizing_optimize-level=3.txt b/test/passes/inlining-optimizing_optimize-level=3.txt index c49fead59..42420c3c9 100644 --- a/test/passes/inlining-optimizing_optimize-level=3.txt +++ b/test/passes/inlining-optimizing_optimize-level=3.txt @@ -7414,19 +7414,23 @@ (i32.const 48) ) ) - (local.set $0 + (local.set $1 (i32.div_u - (local.tee $1 - (local.get $0) - ) + (local.get $0) (i32.const 10) ) ) - (br_if $while-in1 + (if (i32.ge_u - (local.get $1) + (local.get $0) (i32.const 10) ) + (block + (local.set $0 + (local.get $1) + ) + (br $while-in1) + ) ) ) ) diff --git a/test/passes/remove-unused-brs_shrink-level=1.txt b/test/passes/remove-unused-brs_shrink-level=1.txt index d6d8b4704..62491431f 100644 --- a/test/passes/remove-unused-brs_shrink-level=1.txt +++ b/test/passes/remove-unused-brs_shrink-level=1.txt @@ -24,13 +24,13 @@ ) ) (drop - (if (result i32) - (i32.const 1) + (select (i32.rem_s (i32.const 11) (i32.const 12) ) (i32.const 27) + (i32.const 1) ) ) (drop diff --git a/test/passes/vacuum_all-features.txt b/test/passes/vacuum_all-features.txt index 2581f7654..0b9d70ca4 100644 --- a/test/passes/vacuum_all-features.txt +++ b/test/passes/vacuum_all-features.txt @@ -261,12 +261,6 @@ ) (func $unary-binary-may-trap (drop - (i64.div_s - (i64.const -1) - (i64.const 729618461987467893) - ) - ) - (drop (i64.trunc_f32_u (f32.const 70847791997969805621592064) ) |