Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Sep 16, 2025

This avoids relying on higher level llvm internals such as the well-known __cpp_exception tag but otherwise the tests remain essentially unchanged.

@llvmbot
Copy link
Member

llvmbot commented Sep 16, 2025

@llvm/pr-subscribers-backend-webassembly

Author: Sam Clegg (sbc100)

Changes

Patch is 34.88 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/159141.diff

4 Files Affected:

  • (removed) llvm/test/MC/WebAssembly/tag-section-decoding.ll (-342)
  • (added) llvm/test/MC/WebAssembly/tag-section-decoding.s (+409)
  • (removed) llvm/test/MC/WebAssembly/tag-section.ll (-56)
  • (added) llvm/test/MC/WebAssembly/tag-section.s (+63)
diff --git a/llvm/test/MC/WebAssembly/tag-section-decoding.ll b/llvm/test/MC/WebAssembly/tag-section-decoding.ll
deleted file mode 100644
index 4e3b7688e4806..0000000000000
--- a/llvm/test/MC/WebAssembly/tag-section-decoding.ll
+++ /dev/null
@@ -1,342 +0,0 @@
-; RUN: llc -filetype=obj -wasm-enable-eh -exception-model=wasm -mattr=+exception-handling %s -o - | obj2yaml | FileCheck %s
-
-; This is a regression test for a decoding bug that happens when a tag's
-; sigindex is greater than 63, so we put 63 dummy functions with different
-; signatures before the function that contains the 'throw' instruction to make
-; the tag's sigindex 64.
-
-target triple = "wasm32-unknown-unknown"
-
-declare void @llvm.wasm.throw(i32, ptr)
-
-define i32 @dummy0() {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy1(i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy2(i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy3(i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy4(i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy5(i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy6(i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy7(i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy8(i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy9(i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy10(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy11(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy12(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy13(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy14(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy15(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy16(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy17(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy18(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy19(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy20(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy21(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy22(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy23(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy24(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy25(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy26(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy27(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy28(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy29(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy30(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy31(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy32(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy33(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy34(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy35(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy36(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy37(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy38(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy39(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy40(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy41(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy42(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy43(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy44(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy45(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy46(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy47(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy48(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy49(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy50(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy51(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy52(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy53(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy54(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy55(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy56(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy57(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy58(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy59(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy60(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy61(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy62(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @dummy63(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
-entry:
-  ret i32 0
-}
-
-define i32 @test_throw(ptr %p) {
-  call void @llvm.wasm.throw(i32 0, ptr %p)
-  ret i32 0
-}
-
-; Checks to see if the tag index is correctly decoded in ULEB128. If it is
-; decoded with LEB128, 64 will not be correctly decoded. 64 is the smallest
-; number with which its LEB128 and ULEB128 encodings are different, because its
-; 7th least significant bit is not 0.
-; CHECK:      - Type:            TAG
-; CHECK-NEXT:    TagTypes:        [ 64 ]
diff --git a/llvm/test/MC/WebAssembly/tag-section-decoding.s b/llvm/test/MC/WebAssembly/tag-section-decoding.s
new file mode 100644
index 0000000000000..a3e2cf1e2a6f6
--- /dev/null
+++ b/llvm/test/MC/WebAssembly/tag-section-decoding.s
@@ -0,0 +1,409 @@
+# RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+exception-handling -filetype=obj %s | obj2yaml | FileCheck %s
+
+# This is a regression test for a decoding bug that happens when a tag's
+# sigindex is greater than 63, so we put 63 dummy functions with different
+# signatures before the function that contains the 'throw' instruction to make
+# the tag's sigindex 64.
+
+.tagtype my_exception i32
+
+.globl dummy0
+dummy0:
+  .functype dummy0 () -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy1
+dummy1:
+  .functype dummy1 (i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy2
+dummy2:
+  .functype dummy2 (i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy3
+dummy3:
+  .functype dummy3 (i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy4
+dummy4:
+  .functype dummy4 (i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy5
+dummy5:
+  .functype dummy5 (i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy6
+dummy6:
+  .functype dummy6 (i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy7
+dummy7:
+  .functype dummy7 (i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy8
+dummy8:
+  .functype dummy8 (i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy9
+dummy9:
+  .functype dummy9 (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy10
+dummy10:
+  .functype dummy10 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy11
+dummy11:
+  .functype dummy11 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy12
+dummy12:
+  .functype dummy12 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy13
+dummy13:
+  .functype dummy13 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy14
+dummy14:
+  .functype dummy14 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy15
+dummy15:
+  .functype dummy15 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy16
+dummy16:
+  .functype dummy16 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy17
+dummy17:
+  .functype dummy17 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy18
+dummy18:
+  .functype dummy18 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy19
+dummy19:
+  .functype dummy19 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy20
+dummy20:
+  .functype dummy20 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy21
+dummy21:
+  .functype dummy21 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy22
+dummy22:
+  .functype dummy22 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy23
+dummy23:
+  .functype dummy23 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy24
+dummy24:
+  .functype dummy24 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy25
+dummy25:
+  .functype dummy25 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy26
+dummy26:
+  .functype dummy26 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy27
+dummy27:
+  .functype dummy27 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy28
+dummy28:
+  .functype dummy28 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy29
+dummy29:
+  .functype dummy29 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy30
+dummy30:
+  .functype dummy30 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy31
+dummy31:
+  .functype dummy31 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
+  i32.const 0
+  end_function
+
+.globl dummy32
+dummy32:
+  .functype dummy32 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i...
[truncated]

# CHECK: - Index: 1
# CHECK-NEXT: Kind: TAG
# CHECK-NEXT: Name: my_exception
# CHECK-NEXT: Flags: [ ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously this was

; CHECK-NEXT: Flags: [ BINDING_WEAK ]

But now BINDING_WEAK is gone. What changed?

Copy link
Collaborator Author

@sbc100 sbc100 Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BINDING_WEAK is a property of way that llvm codegen references the __cpp_exception tag. The tag used in this test is now to custom exception tag that is strongly defined.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could make it weakly defined, but that doesn't have any bearing on this test AFIACT.

Copy link
Member

@aheejin aheejin Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mean we should make it weakly defined. I'm asking what changed to make this strongly defined. I might have missed other PRs that did that.

Copy link
Collaborator Author

@sbc100 sbc100 Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__cpp_exception did not change at all here. I just changed the test to use my_exception instead of __cpp_exception which the old .ll was referencing.

I didn't bother to make my_exception weakly defined since that is not important to this test.

The reason the old test used __cpp_exception was because its the only tag that can be referenced from bitcode. Using tags other than that currently requires assembly and I guess that asm support did not exist when this test was originally written?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that defining a custom tag in the asm here makes sense, for the reason you say. Also generally speaking, an approach like that might be easier to get better coverage of the MC layer that the compiler might not use (although I'm not sure that's really happening here).

Really these are part of the benefit of having tests as asm rather than ll in the first place.

Separately: IIRC we do still have tests that go from ll -> asm that cover the codegen here and they are unchanged, so I think that should be fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for codegen tests we have llvm/test/CodeGen/WebAssembly/exception.ll

Copy link
Collaborator Author

@sbc100 sbc100 Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and exception-legacy.l and cfg-stackify-eh.ll)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, MC tests should really be testing just the MC layer, not llvm bitcode stuff

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed the tag name has changed and my_exception is defined in the same file.

@sbc100 sbc100 requested a review from aheejin September 16, 2025 18:48
@sbc100 sbc100 merged commit 20d4e5c into llvm:main Sep 16, 2025
11 checks passed
@sbc100 sbc100 deleted the convert_tag_tests branch September 16, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants