[llvm] [WebAssembly] Fold unsigned offset (PR #145829)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 1 13:20:57 PDT 2025
================
@@ -34,7 +34,7 @@ define void @throw(ptr %p) {
; CHECK: call foo
; CHECK: catch $[[EXN:[0-9]+]]=, __cpp_exception
; CHECK: global.set __stack_pointer
-; CHECK: i32.{{store|const}} {{.*}} __wasm_lpad_context
+; CHECK: i32.{{store|const}} {{.*}} 4
----------------
badumbatish wrote:
here's the full CHECK log for the catch function, i'll change line 37 to CHECK:
`i32.store __wasm_lpad_context`
```
define void @catch() personality ptr @__gxx_wasm_personality_v0 {
; CHECK-LABEL: catch:
; CHECK: .Lfunc_begin0:
; CHECK-NEXT: .functype catch () -> ()
; CHECK-NEXT: # %bb.0: # %entry
; CHECK-NEXT: global.get $1=, __stack_pointer
; CHECK-NEXT: try
; CHECK-NEXT: .Ltmp0:
; CHECK-NEXT: call foo
; CHECK-NEXT: .Ltmp1:
; CHECK-NEXT: .LBB1_1: # %catch.start
; CHECK-NEXT: .Ltmp2:
; CHECK-NEXT: catch $0=, __cpp_exception # catch0:
; CHECK-NEXT: global.set __stack_pointer, $1
; CHECK-NEXT: i32.const $push1=, 4
; CHECK-NEXT: i32.const $push0=, GCC_except_table1
; CHECK-NEXT: i32.store __wasm_lpad_context($pop1), $pop0
; CHECK-NEXT: i32.const $push2=, 0
; CHECK-NEXT: i32.const $push7=, 0
; CHECK-NEXT: i32.store __wasm_lpad_context($pop2), $pop7
; CHECK-NEXT: call $drop=, _Unwind_CallPersonality, $0
; CHECK-NEXT: block
; CHECK-NEXT: i32.const $push3=, 8
; CHECK-NEXT: i32.load $push4=, __wasm_lpad_context($pop3)
; CHECK-NEXT: i32.const $push5=, 1
; CHECK-NEXT: i32.ne $push6=, $pop4, $pop5
; CHECK-NEXT: br_if 0, $pop6 # 0: down to label1
; CHECK-NEXT: # %bb.2: # %catch
; CHECK-NEXT: call $drop=, __cxa_begin_catch, $0
; CHECK-NEXT: call __cxa_end_catch
; CHECK-NEXT: br 1 # 1: down to label0
; CHECK-NEXT: .LBB1_3: # %rethrow
; CHECK-NEXT: end_block # label1:
; CHECK-NEXT: rethrow 0 # to caller
; CHECK-NEXT: .LBB1_4: # %try.cont
; CHECK-NEXT: end_try # label0:
; CHECK-NEXT: return
```
https://github.com/llvm/llvm-project/pull/145829
More information about the llvm-commits
mailing list