diff --git a/llvm/include/llvm/IR/IntrinsicsWebAssembly.td b/llvm/include/llvm/IR/IntrinsicsWebAssembly.td --- a/llvm/include/llvm/IR/IntrinsicsWebAssembly.td +++ b/llvm/include/llvm/IR/IntrinsicsWebAssembly.td @@ -63,12 +63,12 @@ def int_wasm_get_ehselector : Intrinsic<[llvm_i32_ty], [llvm_token_ty], [IntrHasSideEffects]>; -// wasm.catch.exn returns the pointer to the exception object caught by wasm -// 'catch' instruction. This returns a single pointer, which is the case for C++ +// wasm.catch returns the pointer to the exception object caught by wasm 'catch' +// instruction. This returns a single pointer, which is the case for C++ // exceptions. The immediate argument is an index to for a tag, which is 0 for // C++ exceptions. -def int_wasm_catch_exn : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], - [IntrHasSideEffects, ImmArg>]>; +def int_wasm_catch : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], + [IntrHasSideEffects, ImmArg>]>; // WebAssembly EH must maintain the landingpads in the order assigned to them // by WasmEHPrepare pass to generate landingpad table in EHStreamer. This is diff --git a/llvm/lib/CodeGen/WasmEHPrepare.cpp b/llvm/lib/CodeGen/WasmEHPrepare.cpp --- a/llvm/lib/CodeGen/WasmEHPrepare.cpp +++ b/llvm/lib/CodeGen/WasmEHPrepare.cpp @@ -23,7 +23,7 @@ // // - After: // catchpad ... -// exn = wasm.catch.exn(WebAssembly::CPP_EXCEPTION); +// exn = wasm.catch(WebAssembly::CPP_EXCEPTION); // // Only add below in case it's not a single catch (...) // wasm.landingpad.index(index); // __wasm_lpad_context.lpad_index = index; @@ -103,7 +103,7 @@ Function *LPadIndexF = nullptr; // wasm.landingpad.index() intrinsic Function *LSDAF = nullptr; // wasm.lsda() intrinsic Function *GetExnF = nullptr; // wasm.get.exception() intrinsic - Function *CatchF = nullptr; // wasm.catch.exn() intrinsic + Function *CatchF = nullptr; // wasm.catch() intrinsic Function *GetSelectorF = nullptr; // wasm.get.ehselector() intrinsic FunctionCallee CallPersonalityF = nullptr; // _Unwind_CallPersonality() wrapper @@ -232,9 +232,9 @@ GetExnF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_get_exception); GetSelectorF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_get_ehselector); - // wasm.catch.exn() will be lowered down to wasm 'catch' instruction in + // wasm.catch() will be lowered down to wasm 'catch' instruction in // instruction selection. - CatchF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_catch_exn); + CatchF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_catch); // _Unwind_CallPersonality() wrapper function, which calls the personality CallPersonalityF = M.getOrInsertFunction( @@ -288,8 +288,8 @@ return; } - // Replace wasm.get.exception intrinsic with wasm.catch.exn intrinsic, which - // will be lowered to wasm 'catch' instruction. We do this mainly because + // Replace wasm.get.exception intrinsic with wasm.catch intrinsic, which will + // be lowered to wasm 'catch' instruction. We do this mainly because // instruction selection cannot handle wasm.get.exception intrinsic's token // argument. Instruction *CatchCI = diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp @@ -186,7 +186,7 @@ return; } - case Intrinsic::wasm_catch_exn: { + case Intrinsic::wasm_catch: { int Tag = Node->getConstantOperandVal(2); SDValue SymNode = getTagSymNode(Tag, CurDAG); MachineSDNode *Catch = diff --git a/llvm/test/CodeGen/WebAssembly/wasmehprepare.ll b/llvm/test/CodeGen/WebAssembly/wasmehprepare.ll --- a/llvm/test/CodeGen/WebAssembly/wasmehprepare.ll +++ b/llvm/test/CodeGen/WebAssembly/wasmehprepare.ll @@ -9,7 +9,7 @@ %struct.Temp = type { i8 } ; A single 'catch (int)' clause. -; A wasm.catch.exn() call, wasm.lsda() call, and personality call to generate a +; A wasm.catch() call, wasm.lsda() call, and personality call to generate a ; selector should all be genereated after the catchpad. ; ; void foo(); @@ -37,7 +37,7 @@ br i1 %matches, label %catch, label %rethrow ; CHECK: catch.start: ; CHECK-NEXT: %[[CATCHPAD:.*]] = catchpad -; CHECK-NEXT: %[[EXN:.*]] = call i8* @llvm.wasm.catch.exn(i32 0) +; CHECK-NEXT: %[[EXN:.*]] = call i8* @llvm.wasm.catch(i32 0) ; CHECK-NEXT: call void @llvm.wasm.landingpad.index(token %[[CATCHPAD]], i32 0) ; CHECK-NEXT: store i32 0, i32* getelementptr inbounds ({ i32, i8*, i32 }, { i32, i8*, i32 }* @__wasm_lpad_context, i32 0, i32 0) ; CHECK-NEXT: %[[LSDA:.*]] = call i8* @llvm.wasm.lsda() @@ -62,10 +62,10 @@ } ; Two try-catches. -; For the catchpad with a single 'catch (...)', only a wasm.catch.exn() call -; should be generated after the catchpad; wasm.landingpad.index() and -; personality call should NOT be generated. For the other catchpad, the argument -; of wasm.landingpad.index() should be not 1 but 0. +; For the catchpad with a single 'catch (...)', only a wasm.catch() call should +; be generated after the catchpad; wasm.landingpad.index() and personality call +; should NOT be generated. For the other catchpad, the argument of +; wasm.landingpad.index() should be not 1 but 0. ; ; void foo(); ; void test1() {