[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

YAMAMOTO Takashi via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 03:05:08 PDT 2024


yamt wrote:

> > Given that we don't need `setjmpTableSize` anymore and `setjmpTable` doesn't change, we don't need the whole block here from line 1463 ~ line 1503 doing SSA updates anymore:
> 
> i get errors like the following if i simply put the SSA update things in `!EnableWasmAltSjLj` block. i need to investigate.
> 
> ```
> spacetanuki% /Volumes/PortableSSD/llvm/build/bin/clang --sysroot /opt/wasi-sdk-21.0/share/wasi-sysroot -resource-dir /Volumes/PortableSSD/llvm/llvm/lib/clang/17 --target=wasm32-wasi -Os -c -mllvm -wasm-enable-sjlj -mllvm -experimental-wasm-enable-alt-sjlj a.c  
> Instruction does not dominate all uses!
>   %val = load i32, ptr %val_gep, align 4
>   %setjmp.ret = phi i32 [ 0, %entry.split ], [ %val, %setjmp.dispatch ]
> in function f
> fatal error: error in backend: Broken function found, compilation aborted!
> PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
> Stack dump:
> 0.      Program arguments: /Volumes/PortableSSD/llvm/build/bin/clang --sysroot /opt/wasi-sdk-21.0/share/wasi-sysroot -resource-dir /Volumes/PortableSSD/llvm/llvm/lib/clang/17 --target=wasm32-wasi -Os -c -mllvm -wasm-enable-sjlj -mllvm -experimental-wasm-enable-alt-sjlj a.c
> 1.      <eof> parser at end of file
> 2.      Code generation
> 3.      Running pass 'Function Pass Manager' on module 'a.c'.
> 4.      Running pass 'Module Verifier' on function '@f'
> ```

i think i found the cause. rebuildSSA is still necessary to propagate "val".


https://github.com/llvm/llvm-project/pull/84137


More information about the cfe-commits mailing list