1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -indvars -S | FileCheck %s
3 ; rdar://10359193: assert "IndVar type must match IVInit type"
5 target 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"
6 target triple = "thumbv7-apple-darwin"
8 define void @test() nounwind {
11 ; CHECK-NEXT: br label [[WHILE_COND:%.*]]
12 ; CHECK: while.cond.loopexit:
13 ; CHECK-NEXT: br label [[WHILE_COND_BACKEDGE:%.*]]
15 ; CHECK-NEXT: br i1 true, label [[WHILE_END:%.*]], label [[WHILE_BODY:%.*]]
17 ; CHECK-NEXT: br i1 undef, label [[IF_THEN165:%.*]], label [[WHILE_COND_BACKEDGE]]
18 ; CHECK: while.cond.backedge:
19 ; CHECK-NEXT: br label [[WHILE_COND]]
21 ; CHECK-NEXT: br i1 undef, label [[WHILE_COND_BACKEDGE]], label [[FOR_BODY_LR_PH_I81:%.*]]
22 ; CHECK: for.body.lr.ph.i81:
23 ; CHECK-NEXT: br label [[FOR_BODY_I86:%.*]]
24 ; CHECK: for.body.i86:
25 ; CHECK-NEXT: [[CMP196_I:%.*]] = icmp ult i32 0, undef
26 ; CHECK-NEXT: br i1 [[CMP196_I]], label [[FOR_BODY21_LR_PH_I:%.*]], label [[FOR_END_I129:%.*]]
27 ; CHECK: for.body21.lr.ph.i:
28 ; CHECK-NEXT: br label [[FOR_BODY21_I:%.*]]
29 ; CHECK: for.body21.i:
30 ; CHECK-NEXT: [[DESTYPIXELPTR_010_I:%.*]] = phi i8* [ null, [[FOR_BODY21_LR_PH_I]] ], [ [[INCDEC_PTR_I:%.*]], [[IF_END_I126:%.*]] ]
31 ; CHECK-NEXT: [[X_09_I:%.*]] = phi i32 [ 0, [[FOR_BODY21_LR_PH_I]] ], [ [[INC_I125:%.*]], [[IF_END_I126]] ]
32 ; CHECK-NEXT: br i1 undef, label [[IF_END_I126]], label [[IF_ELSE_I124:%.*]]
33 ; CHECK: if.else.i124:
34 ; CHECK-NEXT: store i8 undef, i8* [[DESTYPIXELPTR_010_I]], align 1
35 ; CHECK-NEXT: br label [[IF_END_I126]]
37 ; CHECK-NEXT: [[INCDEC_PTR_I]] = getelementptr inbounds i8, i8* [[DESTYPIXELPTR_010_I]], i32 1
38 ; CHECK-NEXT: [[INC_I125]] = add nuw i32 [[X_09_I]], 1
39 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[INC_I125]], undef
40 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY21_I]], label [[FOR_END_I129_LOOPEXIT:%.*]]
41 ; CHECK: for.end.i129.loopexit:
42 ; CHECK-NEXT: br label [[FOR_END_I129]]
43 ; CHECK: for.end.i129:
44 ; CHECK-NEXT: br i1 false, label [[FOR_BODY_I86]], label [[WHILE_COND_LOOPEXIT:%.*]]
46 ; CHECK-NEXT: br label [[BAIL:%.*]]
48 ; CHECK-NEXT: unreachable
50 ; CHECK-NEXT: ret void
56 br i1 undef, label %while.end, label %while.body
58 while.body: ; preds = %while.cond
59 br i1 undef, label %if.then165, label %while.cond
61 if.then165: ; preds = %while.body
62 br i1 undef, label %while.cond, label %for.body.lr.ph.i81
64 for.body.lr.ph.i81: ; preds = %if.then165
65 br label %for.body.i86
67 for.body.i86: ; preds = %for.end.i129, %for.body.lr.ph.i81
68 %cmp196.i = icmp ult i32 0, undef
69 br i1 %cmp196.i, label %for.body21.lr.ph.i, label %for.end.i129
71 for.body21.lr.ph.i: ; preds = %for.body.i86
72 br label %for.body21.i
75 %destYPixelPtr.010.i = phi i8* [ null, %for.body21.lr.ph.i ], [ %incdec.ptr.i, %if.end.i126 ]
76 %x.09.i = phi i32 [ 0, %for.body21.lr.ph.i ], [ %inc.i125, %if.end.i126 ]
77 br i1 undef, label %if.end.i126, label %if.else.i124
79 if.else.i124: ; preds = %for.body21.i
80 store i8 undef, i8* %destYPixelPtr.010.i, align 1
83 if.end.i126: ; preds = %if.else.i124, %for.body21.i
84 %incdec.ptr.i = getelementptr inbounds i8, i8* %destYPixelPtr.010.i, i32 1
85 %inc.i125 = add i32 %x.09.i, 1
86 %cmp19.i = icmp ult i32 %inc.i125, undef
87 br i1 %cmp19.i, label %for.body21.i, label %for.end.i129
89 for.end.i129: ; preds = %if.end.i126, %for.body.i86
90 br i1 undef, label %for.body.i86, label %while.cond
92 while.end: ; preds = %while.cond
95 bail: ; preds = %while.end, %lor.lhs.false44, %lor.lhs.false41, %if.end29, %if.end
98 return: ; preds = %lor.lhs.false20, %lor.lhs.false12, %lor.lhs.false, %entry