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