1; RUN: opt < %s -loop-rotate -S | FileCheck %s
2
3target triple = "x86_64-pc-windows-msvc"
4
5declare void @always_throws()
6
7define i32 @test() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
8entry:
9  invoke void @always_throws()
10          to label %continue unwind label %catch.dispatch
11
12continue:
13  unreachable
14
15catch.dispatch:
16  %t0 = catchswitch within none [label %catch] unwind to caller
17
18catch:
19  %t1 = catchpad within %t0 [i8* null, i32 64, i8* null]
20  catchret from %t1 to label %for.cond
21
22for.cond:
23  %sum = phi i32 [ %add, %for.body ], [ 0, %catch ]
24  %i = phi i32 [ %inc, %for.body ], [ 0, %catch ]
25  %cmp = icmp slt i32 %i, 1
26  br i1 %cmp, label %for.body, label %return
27
28for.body:
29  %add = add nsw i32 1, %sum
30  %inc = add nsw i32 %i, 1
31  br label %for.cond
32
33return:
34  ret i32 0
35}
36
37; CHECK: catch:
38; CHECK-NEXT: catchpad
39; CHECK-NEXT: catchret
40
41declare i32 @__CxxFrameHandler3(...)
42