diff options
author | Alon Zakai <azakai@google.com> | 2024-05-15 09:42:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-15 09:42:28 -0700 |
commit | 8a5dc1880d962a7c31a7a219720be343a0866e5c (patch) | |
tree | b76322419dac9600599be135a6558d661aafb709 /test/lit/passes/local-cse.wast | |
parent | 940f4570cb13db7f7b381cbe35ba546708ed7556 (diff) | |
download | binaryen-8a5dc1880d962a7c31a7a219720be343a0866e5c.tar.gz binaryen-8a5dc1880d962a7c31a7a219720be343a0866e5c.tar.bz2 binaryen-8a5dc1880d962a7c31a7a219720be343a0866e5c.zip |
LocalCSE: Fix regression from #6587 by accumulating generativity (#6591)
#6587 was incorrect: It checked generativity early in an incremental manner, but
it did not accumulate that information as we do with hashes. As a result we
could end up optimizing something with a generative child, and sadly we lacked
testing for that case.
This adds incremental generativity computation alongside hashes. It also splits
out this check from isRelevant.
Also add a test for nested effects (as opposed to generativity), but that already
worked before this PR (as we compute effects and invalidation as we go, already).
Diffstat (limited to 'test/lit/passes/local-cse.wast')
-rw-r--r-- | test/lit/passes/local-cse.wast | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/test/lit/passes/local-cse.wast b/test/lit/passes/local-cse.wast index 8b0f51a7c..4f6156dba 100644 --- a/test/lit/passes/local-cse.wast +++ b/test/lit/passes/local-cse.wast @@ -11,7 +11,9 @@ ;; CHECK: (type $2 (func (param i32))) - ;; CHECK: (type $3 (func (result i64))) + ;; CHECK: (type $3 (func (result i32))) + + ;; CHECK: (type $4 (func (result i64))) ;; CHECK: (memory $0 100 100) @@ -356,6 +358,38 @@ ) ) + ;; CHECK: (func $nested-calls (result i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (call $nested-calls) + ;; CHECK-NEXT: (call $nested-calls) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (call $nested-calls) + ;; CHECK-NEXT: (call $nested-calls) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $nested-calls (result i32) + ;; Operations that include nested effects are ignored. + (drop + (i32.add + (call $nested-calls) + (call $nested-calls) + ) + ) + (drop + (i32.add + (call $nested-calls) + (call $nested-calls) + ) + ) + (unreachable) + ) + ;; CHECK: (func $many-sets (result i64) ;; CHECK-NEXT: (local $temp i64) ;; CHECK-NEXT: (local $1 i64) |