1 ; RUN: opt -mtriple=x86_64-pc-windows-msvc -S -win-eh-prepare -disable-demotion -disable-cleanups < %s | FileCheck %s
2 ; RUN: opt -mtriple=x86_64-pc-windows-msvc -S -passes=win-eh-prepare -disable-demotion -disable-cleanups < %s | FileCheck %s
4 declare i32 @__CxxFrameHandler3(...)
6 declare i32 @__C_specific_handler(...)
14 ; CHECK-LABEL: @test1(
15 define void @test1(i1 %bool) personality ptr @__C_specific_handler {
18 to label %invoke.cont unwind label %left
22 to label %exit unwind label %inner
25 %0 = cleanuppad within none []
26 br i1 %bool, label %shared, label %cleanupret
29 cleanupret from %0 unwind label %right
32 %1 = cleanuppad within none []
38 to label %shared.cont unwind label %inner
44 %phi = phi i32 [ %x, %shared ], [ 0, %invoke.cont ]
45 %i = cleanuppad within none []
46 call void @h(i32 %phi)
49 ; CHECK: %phi = phi i32 [ %x, %shared ], [ 0, %invoke.cont ], [ %x.for.left, %shared.for.left ]
50 ; CHECK: %i = cleanuppad within none []
51 ; CHECK: call void @h(i32 %phi)
57 ; CHECK-LABEL: @test2(
58 define void @test2(i1 %bool) personality ptr @__C_specific_handler {
61 to label %shared.cont unwind label %left
64 %0 = cleanuppad within none []
65 br i1 %bool, label %shared, label %cleanupret
68 cleanupret from %0 unwind label %right
71 %1 = cleanuppad within none []
77 to label %shared.cont unwind label %inner
83 %i = cleanuppad within none []
87 ; CHECK: %x1 = phi i32 [ %x.for.left, %shared.for.left ], [ %x, %shared ]
88 ; CHECK: %i = cleanuppad within none []
89 ; CHECK: call void @h(i32 %x1)
95 ; CHECK-LABEL: @test4(
96 define void @test4(i1 %x) personality ptr @__CxxFrameHandler3 {
99 to label %invoke.cont1 unwind label %left
103 to label %exit unwind label %right
106 %0 = cleanuppad within none []
110 %1 = cleanuppad within none []
111 br i1 %x, label %shared, label %right.other
117 %phi = phi i32 [ 1, %left ], [ 0, %right ], [ -1, %right.other ]
118 call void @h(i32 %phi)
121 ; CHECK: %phi = phi i32 [ 0, %right ], [ -1, %right.other ]
122 ; CHECK: call void @h(i32 %phi)
124 ; CHECK: %phi.for.left = phi i32 [ 1, %left ]
125 ; CHECK: call void @h(i32 %phi.for.left)
131 declare void @__std_terminate()