Skip to content

[WebAssembly] Add more EH assembly test cases #108654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 14, 2024

Conversation

aheejin
Copy link
Member

@aheejin aheejin commented Sep 13, 2024

This adds assembly tests for a catch-less try and a try with a multivalue return.

This adds assembly tests for a catch-less `try` and a `try` with a
multivalue return.
@aheejin aheejin requested a review from dschuff September 13, 2024 22:06
@llvmbot llvmbot added backend:WebAssembly mc Machine (object) code labels Sep 13, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 13, 2024

@llvm/pr-subscribers-mc

@llvm/pr-subscribers-backend-webassembly

Author: Heejin Ahn (aheejin)

Changes

This adds assembly tests for a catch-less try and a try with a multivalue return.


Full diff: https://github.com/llvm/llvm-project/pull/108654.diff

1 Files Affected:

  • (modified) llvm/test/MC/WebAssembly/eh-assembly.s (+29)
diff --git a/llvm/test/MC/WebAssembly/eh-assembly.s b/llvm/test/MC/WebAssembly/eh-assembly.s
index c84a65e55605cc..d31b66bed92302 100644
--- a/llvm/test/MC/WebAssembly/eh-assembly.s
+++ b/llvm/test/MC/WebAssembly/eh-assembly.s
@@ -36,6 +36,21 @@ eh_legacy_test:
   catch       __cpp_exception
   end_try
   drop
+
+  # try-catch with a mulvivalue return
+  try () -> (i32, f32)
+    i32.const 0
+    f32.const 0.0
+  catch       __cpp_exception
+    f32.const 1.0
+  end_try
+  drop
+  drop
+
+  # Catch-less try
+  try
+    call  foo
+  end_try
   end_function
 
 # CHECK-LABEL: eh_legacy_test:
@@ -64,4 +79,18 @@ eh_legacy_test:
 # CHECK-NEXT:    catch           __cpp_exception
 # CHECK-NEXT:    end_try
 # CHECK-NEXT:    drop
+
+# CHECK:         try             () -> (i32, f32)
+# CHECK-NEXT:    i32.const       0
+# CHECK-NEXT:    f32.const       0x0p0
+# CHECK-NEXT:    catch           __cpp_exception
+# CHECK-NEXT:    f32.const       0x1p0
+# CHECK-NEXT:    end_try
+# CHECK-NEXT:    drop
+# CHECK-NEXT:    drop
+
+# CHECK:         try
+# CHECK-NEXT:    call    foo
+# CHECK-NEXT:    end_try
 # CHECK-NEXT:    end_function
+

@aheejin aheejin merged commit 2064557 into llvm:main Sep 14, 2024
11 checks passed
@aheejin aheejin deleted the try_multivalue_return branch September 14, 2024 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:WebAssembly mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants