1; RUN: opt -S -loop-unroll %s | FileCheck %s
2target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
3target triple = "x86_64-pc-windows-msvc18.0.0"
4
5define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
6entry:
7  br label %for.body
8
9for.body:                                         ; preds = %entry, %for.inc
10  %phi = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
11  invoke void @callee(i32 %phi)
12          to label %for.inc unwind label %ehcleanup
13
14for.inc:                                          ; preds = %for.body
15  %inc = add nuw nsw i32 %phi, 1
16  %cmp = icmp slt i32 %inc, 3
17  br i1 %cmp, label %for.body, label %for.cond.cleanup
18
19for.cond.cleanup:                                 ; preds = %for.inc
20  call void @dtor()
21  ret void
22
23ehcleanup:                                        ; preds = %for.body
24  %cp = cleanuppad within none []
25  call void @dtor() [ "funclet"(token %cp) ]
26  cleanupret from %cp unwind to caller
27}
28
29; CHECK-LABEL: define void @test1(
30; CHECK: invoke void @callee(i32 0
31
32; CHECK: invoke void @callee(i32 1
33
34; CHECK: invoke void @callee(i32 2
35
36declare void @callee(i32)
37
38declare i32 @__CxxFrameHandler3(...)
39
40declare void @dtor()
41