1; RUN: opt < %s -indvars -S | FileCheck %s
2
3; Provide legal integer types.
4target datalayout = "n8:16:32:64"
5
6
7target triple = "x86_64-apple-darwin"
8
9; CHECK-LABEL: @sloop
10; CHECK-LABEL: B18:
11; Only one phi now.
12; CHECK: phi
13; CHECK-NOT: phi
14; One trunc for the gep.
15; CHECK: trunc i64 %indvars.iv to i32
16; One trunc for the dummy() call.
17; CHECK-LABEL: exit24:
18; CHECK: trunc i64 {{.*}}lcssa.wide to i32
19define void @sloop(i32* %a) {
20Prologue:
21  br i1 undef, label %B18, label %B6
22
23B18:                                        ; preds = %B24, %Prologue
24  %.02 = phi i32 [ 0, %Prologue ], [ %tmp33, %B24 ]
25  %tmp23 = zext i32 %.02 to i64
26  %tmp33 = add i32 %.02, 1
27  %o = getelementptr i32, i32* %a, i32 %.02
28  %v = load i32, i32* %o
29  %t = icmp eq i32 %v, 0
30  br i1 %t, label %exit24, label %B24
31
32B24:                                        ; preds = %B18
33  %t2 = icmp eq i32 %tmp33, 20
34  br i1 %t2, label %B6, label %B18
35
36B6:                                       ; preds = %Prologue
37  ret void
38
39exit24:                      ; preds = %B18
40  call void @dummy(i32 %.02)
41  unreachable
42}
43
44declare void @dummy(i32)
45