diff options
author | Alon Zakai <azakai@google.com> | 2024-10-07 15:37:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-07 15:37:26 -0700 |
commit | cc40ed0684153a9954d32d5b6b2cf5856e0c15cb (patch) | |
tree | 56446a0bed834ec9fc134bf8c2cc32141896c33f /test/lit/passes/remove-unused-brs-eh.wast | |
parent | bcdedab9a97dbea1c2ee151ca1013e3896f16c8a (diff) | |
download | binaryen-cc40ed0684153a9954d32d5b6b2cf5856e0c15cb.tar.gz binaryen-cc40ed0684153a9954d32d5b6b2cf5856e0c15cb.tar.bz2 binaryen-cc40ed0684153a9954d32d5b6b2cf5856e0c15cb.zip |
Fix a misoptimization with mixed Try/TryTable in RemoveUnusedBrs (#6991)
We ignored legacy Trys in #6980, but they can also catch.
Diffstat (limited to 'test/lit/passes/remove-unused-brs-eh.wast')
-rw-r--r-- | test/lit/passes/remove-unused-brs-eh.wast | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/lit/passes/remove-unused-brs-eh.wast b/test/lit/passes/remove-unused-brs-eh.wast index 544ff81b0..b3b89df63 100644 --- a/test/lit/passes/remove-unused-brs-eh.wast +++ b/test/lit/passes/remove-unused-brs-eh.wast @@ -245,6 +245,40 @@ ) ) + ;; CHECK: (func $throw-mixed (type $0) + ;; CHECK-NEXT: (block $catch + ;; CHECK-NEXT: (try_table (catch_all $catch) + ;; CHECK-NEXT: (try + ;; CHECK-NEXT: (do + ;; CHECK-NEXT: (throw $e) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (catch_all + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $throw-mixed + ;; When we see mixed Trys and TryTables, we do not optimize (we would need + ;; to analyze if the Trys catch the exceptions and not the TryTables, but + ;; we don't bother to handle this odd case of mixing the old and new + ;; styles of code). + (block $catch + (try_table (catch_all $catch) + (try + (do + ;; This throw is caught by the Try, not the TryTable. + (throw $e) + ) + (catch_all + (unreachable) + ) + ) + ) + ) + ) + ;; CHECK: (func $threading (type $0) ;; CHECK-NEXT: (block $outer ;; CHECK-NEXT: (block $middle |