Index: lib/Target/WebAssembly/WebAssemblyInstrControl.td =================================================================== --- lib/Target/WebAssembly/WebAssemblyInstrControl.td +++ lib/Target/WebAssembly/WebAssemblyInstrControl.td @@ -125,8 +125,9 @@ def THROW_I64 : I<(outs), (ins i32imm:$tag, I64:$val), [(int_wasm_throw imm:$tag, I64:$val)], "throw \t$tag, $val", 0x08>; -def RETHROW : I<(outs), (ins i32imm:$rel_depth), [], "rethrow \t$rel_depth", - 0x09>; +// rethrow instruction takes an except_ref type argument, but it is omitted here +// because it will be added after instruction selection. +def RETHROW : I<(outs), (ins), [(int_wasm_rethrow)], "rethrow", 0x09>; } // isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 // Region within which an exception is caught: try / end_try @@ -136,8 +137,3 @@ } // Uses = [VALUE_STACK], Defs = [VALUE_STACK] } // Defs = [ARGUMENTS] - -// rethrow takes a relative depth as an argument, for which currently only 0 is -// possible for C++. Once other languages need depths other than 0, depths will -// be computed in CFGStackify. -def : Pat<(int_wasm_rethrow), (RETHROW 0)>; Index: test/CodeGen/WebAssembly/exception.ll =================================================================== --- test/CodeGen/WebAssembly/exception.ll +++ test/CodeGen/WebAssembly/exception.ll @@ -15,7 +15,7 @@ } ; CHECK-LABEL: rethrow: -; CHECK-NEXT: rethrow 0 +; CHECK-NEXT: rethrow define void @rethrow() { call void @llvm.wasm.rethrow() ret void