1; RUN: opt < %s -indvars -S | FileCheck %s
2; rdar://10359193: assert "IndVar type must match IVInit type"
3
4target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
5target triple = "thumbv7-apple-darwin"
6
7; CHECK-LABEL: @test(
8; CHECK: if.end.i126:
9; CHECK: %exitcond = icmp ne i8* %incdec.ptr.i, getelementptr (i8, i8* null, i32 undef)
10define void @test() nounwind {
11entry:
12  br label %while.cond
13
14while.cond:
15  br i1 undef, label %while.end, label %while.body
16
17while.body:                                       ; preds = %while.cond
18  br i1 undef, label %if.then165, label %while.cond
19
20if.then165:                                       ; preds = %while.body
21  br i1 undef, label %while.cond, label %for.body.lr.ph.i81
22
23for.body.lr.ph.i81:                               ; preds = %if.then165
24  br label %for.body.i86
25
26for.body.i86:                                     ; preds = %for.end.i129, %for.body.lr.ph.i81
27  %cmp196.i = icmp ult i32 0, undef
28  br i1 %cmp196.i, label %for.body21.lr.ph.i, label %for.end.i129
29
30for.body21.lr.ph.i:                               ; preds = %for.body.i86
31  br label %for.body21.i
32
33for.body21.i:
34  %destYPixelPtr.010.i = phi i8* [ null, %for.body21.lr.ph.i ], [ %incdec.ptr.i, %if.end.i126 ]
35  %x.09.i = phi i32 [ 0, %for.body21.lr.ph.i ], [ %inc.i125, %if.end.i126 ]
36  br i1 undef, label %if.end.i126, label %if.else.i124
37
38if.else.i124:                                     ; preds = %for.body21.i
39  store i8 undef, i8* %destYPixelPtr.010.i, align 1
40  br label %if.end.i126
41
42if.end.i126:                                      ; preds = %if.else.i124, %for.body21.i
43  %incdec.ptr.i = getelementptr inbounds i8, i8* %destYPixelPtr.010.i, i32 1
44  %inc.i125 = add i32 %x.09.i, 1
45  %cmp19.i = icmp ult i32 %inc.i125, undef
46  br i1 %cmp19.i, label %for.body21.i, label %for.end.i129
47
48for.end.i129:                                     ; preds = %if.end.i126, %for.body.i86
49  br i1 undef, label %for.body.i86, label %while.cond
50
51while.end:                                        ; preds = %while.cond
52  br label %bail
53
54bail:                                             ; preds = %while.end, %lor.lhs.false44, %lor.lhs.false41, %if.end29, %if.end
55  unreachable
56
57return:                                           ; preds = %lor.lhs.false20, %lor.lhs.false12, %lor.lhs.false, %entry
58  ret void
59}
60