From 161935520d5a9cd1fcaddee39bb8438bcfec5552 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sun, 4 Oct 2015 02:22:52 +0000 Subject: [WinEH] Permit branch folding in the face of funclets Track which basic blocks belong to which funclets. Permit branch folding to fire but only if it can prove that doing so will not cause code in one funclet to be reused in another. llvm-svn: 249257 --- llvm/test/CodeGen/X86/funclet-layout.ll | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'llvm/test/CodeGen/X86/funclet-layout.ll') diff --git a/llvm/test/CodeGen/X86/funclet-layout.ll b/llvm/test/CodeGen/X86/funclet-layout.ll index d31ae2312c2..ffd4b49b688 100644 --- a/llvm/test/CodeGen/X86/funclet-layout.ll +++ b/llvm/test/CodeGen/X86/funclet-layout.ll @@ -103,7 +103,7 @@ unreachable: ; preds = %catch, %entry ; CHECK: retq -define void @test3() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) { +define void @test3(i1 %V) #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) { entry: invoke void @g() to label %try.cont unwind label %catch.dispatch @@ -128,7 +128,15 @@ catchendblock: ; preds = %catch.dispatch.1 catchendpad unwind to caller try.cont: ; preds = %entry - ret void + br i1 %V, label %exit_one, label %exit_two + +exit_one: + tail call void @exit(i32 0) + unreachable + +exit_two: + tail call void @exit(i32 0) + unreachable } ; CHECK-LABEL: test3: @@ -136,15 +144,20 @@ try.cont: ; preds = %entry ; The entry funclet contains %entry and %try.cont ; CHECK: # %entry ; CHECK: # %try.cont -; CHECK: retq +; CHECK: callq exit +; CHECK-NOT: # exit_one +; CHECK-NOT: # exit_two +; CHECK: ud2 ; The catch(int) funclet contains %catch.2 ; CHECK: # %catch.2 ; CHECK: callq exit +; CHECK: ud2 ; The catch(...) funclet contains %catch ; CHECK: # %catch{{$}} ; CHECK: callq exit +; CHECK: ud2 declare void @exit(i32) noreturn nounwind declare void @_CxxThrowException(i8*, %eh.ThrowInfo*) -- cgit v1.2.3