diff options
| -rw-r--r-- | clang/include/clang/Basic/BuiltinsWebAssembly.def | 1 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 4 | ||||
| -rw-r--r-- | clang/test/CodeGen/builtins-wasm.c | 6 |
3 files changed, 11 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/BuiltinsWebAssembly.def b/clang/include/clang/Basic/BuiltinsWebAssembly.def index e9d8ea63256..19318dcebb9 100644 --- a/clang/include/clang/Basic/BuiltinsWebAssembly.def +++ b/clang/include/clang/Basic/BuiltinsWebAssembly.def @@ -23,5 +23,6 @@ BUILTIN(__builtin_wasm_grow_memory, "zz", "n") // Exception handling builtins. BUILTIN(__builtin_wasm_throw, "vUiv*", "r") +BUILTIN(__builtin_wasm_rethrow, "v", "r") #undef BUILTIN diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 3e353ea7eca..27403cb30d1 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -9613,6 +9613,10 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID, Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_throw); return Builder.CreateCall(Callee, {Tag, Obj}); } + case WebAssembly::BI__builtin_wasm_rethrow: { + Value *Callee = CGM.getIntrinsic(Intrinsic::wasm_rethrow); + return Builder.CreateCall(Callee); + } default: return nullptr; diff --git a/clang/test/CodeGen/builtins-wasm.c b/clang/test/CodeGen/builtins-wasm.c index 2361fdf40ce..e0f72d2e503 100644 --- a/clang/test/CodeGen/builtins-wasm.c +++ b/clang/test/CodeGen/builtins-wasm.c @@ -20,3 +20,9 @@ void f3(unsigned int tag, void *obj) { // WEBASSEMBLY32: call void @llvm.wasm.throw(i32 %{{.*}}, i8* %{{.*}}) // WEBASSEMBLY64: call void @llvm.wasm.throw(i32 %{{.*}}, i8* %{{.*}}) } + +void f4() { + return __builtin_wasm_rethrow(); +// WEBASSEMBLY32: call void @llvm.wasm.rethrow() +// WEBASSEMBLY64: call void @llvm.wasm.rethrow() +} |

