diff options
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r-- | llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll b/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll index 104e324faae..191c3d78552 100644 --- a/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll +++ b/llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll @@ -621,6 +621,49 @@ try.cont: ; preds = %catch.start1, %catc ret void } +; In CFGSort, EH pads should be sorted as soon as it is available and +; 'Preferred' queue and should NOT be entered into 'Ready' queue unless we are +; in the middle of sorting another region that does not contain the EH pad. In +; this example, 'catch.start' should be sorted right after 'if.then' is sorted +; (before 'cont' is sorted) and there should not be any unwind destination +; mismatches in CFGStackify. + +; NOOPT: block +; NOOPT: try +; NOOPT: call foo +; NOOPT: catch +; NOOPT: end_try +; NOOPT: call foo +; NOOPT: end_block +; NOOPT: return +define void @test9(i32 %arg) personality i8* bitcast (i32 (...)* @__gxx_wasm_personality_v0 to i8*) { +entry: + %tobool = icmp ne i32 %arg, 0 + br i1 %tobool, label %if.then, label %if.end + +catch.dispatch: ; preds = %if.then + %0 = catchswitch within none [label %catch.start] unwind to caller + +catch.start: ; preds = %catch.dispatch + %1 = catchpad within %0 [i8* null] + %2 = call i8* @llvm.wasm.get.exception(token %1) + %3 = call i32 @llvm.wasm.get.ehselector(token %1) + %4 = call i8* @__cxa_begin_catch(i8* %2) [ "funclet"(token %1) ] + call void @__cxa_end_catch() [ "funclet"(token %1) ] + catchret from %1 to label %if.end + +if.then: ; preds = %entry + invoke void @foo() + to label %cont unwind label %catch.dispatch + +cont: ; preds = %if.then + call void @foo() + br label %if.end + +if.end: ; preds = %cont, %catch.start, %entry + ret void +} + declare void @foo() declare void @bar() declare i32 @baz() |