summaryrefslogtreecommitdiff
path: root/test/CodeGen/WinEH
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-12-23 03:59:04 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-12-23 03:59:04 +0000
commit0f16f3c826def2829befdbff764ef3d8ada3032c (patch)
treeaa85b52889de4a2032901bc724c4fe4b16ade657 /test/CodeGen/WinEH
parent5a39c0c83b3b07485a09cea2020f78309fb3ce7c (diff)
[WinEH] Don't visit the same catchswitch twice
We visited the same catchswitch twice because it was both the child of another funclet and the predecessor of a cleanuppad. Instead, change the numbering algorithm to only recurse if the unwind destination of the inner funclet agrees with the unwind destination of the catchswitch. This fixes PR25926. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/WinEH')
-rw-r--r--test/CodeGen/WinEH/wineh-statenumbering.ll55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/CodeGen/WinEH/wineh-statenumbering.ll b/test/CodeGen/WinEH/wineh-statenumbering.ll
index b7ec843aa39..dab7fde61a6 100644
--- a/test/CodeGen/WinEH/wineh-statenumbering.ll
+++ b/test/CodeGen/WinEH/wineh-statenumbering.ll
@@ -79,8 +79,63 @@ define i32 @nopads() #0 personality i32 (...)* @__CxxFrameHandler3 {
; CHECK-NEXT: ret i32 0
; CHECK-NOT: __ehhandler$nopads
+; CHECK-LABEL: define void @PR25926()
+define void @PR25926() personality i32 (...)* @__CxxFrameHandler3 {
+entry:
+ ; CHECK: entry:
+ ; CHECK: store i32 -1
+ ; CHECK: store i32 0
+ ; CHECK: invoke void @_CxxThrowException(
+ invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null)
+ to label %unreachable unwind label %catch.dispatch
+
+catch.dispatch: ; preds = %entry
+ %0 = catchswitch within none [label %catch] unwind to caller
+
+catch: ; preds = %catch.dispatch
+ %1 = catchpad within %0 [i8* null, i32 64, i8* null]
+ ; CHECK: catch:
+ ; CHECK: store i32 3
+ ; CHECK: invoke void @_CxxThrowException(
+ invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) [ "funclet"(token %1) ]
+ to label %unreachable1 unwind label %catch.dispatch1
+
+catch.dispatch1: ; preds = %catch
+ %2 = catchswitch within %1 [label %catch2] unwind label %ehcleanup
+
+catch2: ; preds = %catch.dispatch1
+ %3 = catchpad within %2 [i8* null, i32 64, i8* null]
+ catchret from %3 to label %try.cont
+
+try.cont: ; preds = %catch2
+ ; CHECK: try.cont:
+ ; CHECK: store i32 1
+ ; CHECK: call void @dtor()
+ call void @dtor() #3 [ "funclet"(token %1) ]
+ catchret from %1 to label %try.cont4
+
+try.cont4: ; preds = %try.cont
+ ret void
+
+ehcleanup: ; preds = %catch.dispatch1
+ %4 = cleanuppad within %1 []
+ ; CHECK: ehcleanup:
+ ; CHECK: store i32 -1
+ ; CHECK: call void @dtor()
+ call void @dtor() #3 [ "funclet"(token %4) ]
+ cleanupret from %4 unwind to caller
+
+unreachable: ; preds = %entry
+ unreachable
+
+unreachable1: ; preds = %catch
+ unreachable
+}
+
declare void @g(i32) #0
+declare void @dtor()
+
declare x86_stdcallcc void @_CxxThrowException(i8*, %eh.ThrowInfo*)
declare i32 @__CxxFrameHandler3(...)