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

Heejin Ahn via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 23:26:23 PST 2024


================
@@ -1738,10 +1792,16 @@ void WebAssemblyLowerEmscriptenEHSjLj::handleLongjmpableCallsForWasmSjLj(
   BasicBlock *ThenBB = BasicBlock::Create(C, "if.then", &F);
   BasicBlock *EndBB = BasicBlock::Create(C, "if.end", &F);
   Value *EnvP = IRB.CreateBitCast(Env, getAddrPtrType(&M), "env.p");
-  Value *SetjmpID = IRB.CreateLoad(getAddrIntType(&M), EnvP, "setjmp.id");
-  Value *Label =
-      IRB.CreateCall(TestSetjmpF, {SetjmpID, SetjmpTable, SetjmpTableSize},
-                     OperandBundleDef("funclet", CatchPad), "label");
+  Value *Label;
+  if (EnableWasmAltSjLj) {
+    Label = IRB.CreateCall(TestSetjmpF, {EnvP, SetjmpTable},
+                           OperandBundleDef("funclet", CatchPad), "label");
+  } else {
----------------
aheejin wrote:

We can move https://github.com/llvm/llvm-project/blob/6c765069112e31ec66cd4387f2a39f70583e626b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp#L1685-L1688 into this `else`, given that `SetjmpTableInsts` and `SetjmpTableSizeInsts` are empty in this new mode.

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


More information about the cfe-commits mailing list