1 ; RUN: opt -passes=indvars -S < %s | FileCheck %s
3 @__const.e.f = private unnamed_addr constant <{ <{ [2 x i32], [2 x i32], [8 x [2 x i32]] }>, [10 x [2 x i32]] }> <{ <{ [2 x i32], [2 x i32], [8 x [2 x i32]] }> <{ [2 x i32] [i32 4, i32 8], [2 x i32] [i32 3, i32 10], [8 x [2 x i32]] zeroinitializer }>, [10 x [2 x i32]] [[2 x i32] zeroinitializer, [2 x i32] zeroinitializer, [2 x i32] [i32 1, i32 5], [2 x i32] [i32 2080555007, i32 0], [2 x i32] zeroinitializer, [2 x i32] zeroinitializer, [2 x i32] zeroinitializer, [2 x i32] zeroinitializer, [2 x i32] zeroinitializer, [2 x i32] zeroinitializer] }>, align 4
5 define dso_local i8 @main() local_unnamed_addr {
7 br label %for.cond1.preheader
9 for.cond1.preheader: ; preds = %for.inc15, %entry
10 %storemerge32 = phi i32 [ 0, %entry ], [ %inc16, %for.inc15 ]
13 for.cond4: ; preds = %for.inc, %for.cond1.preheader
14 %storemerge2531 = phi i32 [ 0, %for.cond1.preheader ], [ %inc, %for.inc ]
15 %tobool = icmp eq i32 1, 0
16 br i1 %tobool, label %cleanup, label %if.then
18 if.then: ; preds = %for.cond4
19 ; CHECK: if.then: ; preds = %for.cond4
20 ; CHECK-NEXT: br i1 false, label %cleanup, label %for.inc
21 %add = add nuw nsw i32 %storemerge2531, 2
22 %idxprom8 = zext i32 %add to i64
23 %arrayidx10 = getelementptr inbounds <{ <{ [2 x i32], [2 x i32], [8 x [2 x i32]] }>, [10 x [2 x i32]] }>, ptr @__const.e.f, i64 0, i32 1, i64 %idxprom8, i64 0
24 %0 = load i32, ptr %arrayidx10, align 4
25 %tobool11 = icmp eq i32 %0, 0
26 br i1 %tobool11, label %cleanup, label %for.inc
28 for.inc: ; preds = %if.then
29 %inc = add nuw nsw i32 %storemerge2531, 1
30 %cmp2 = icmp ult i32 %inc, 2
31 br i1 %cmp2, label %for.cond4, label %for.inc15
33 cleanup: ; preds = %if.then, %for.cond4
36 for.inc15: ; preds = %for.inc
38 ; CHECK-NEXT: %inc16 = add nuw nsw i32 %storemerge32, 1
39 ; CHECK-NEXT: %cmp = icmp eq i32 %inc16, 4
40 ; CHECK-NEXT: br i1 %cmp, label %for.cond18thread-pre-split, label %for.cond1.preheader
41 %inc16 = add nuw nsw i32 %storemerge32, 1
42 %cmp = icmp eq i32 %inc16, 4
43 br i1 %cmp, label %for.cond18thread-pre-split, label %for.cond1.preheader
45 for.cond18thread-pre-split: ; preds = %for.inc15
46 br i1 1, label %return.loopexit, label %for.inc21.lr.ph
48 for.inc21.lr.ph: ; preds = %for.cond18thread-pre-split
51 for.inc21: ; preds = %for.inc21, %for.inc21.lr.ph
52 %1 = phi i32 [ undef, %for.inc21.lr.ph ], [ %inc22, %for.inc21 ]
53 %inc22 = add nsw i32 %1, 1
54 br i1 true, label %for.cond18.return.loopexit_crit_edge, label %for.inc21
56 for.cond18.return.loopexit_crit_edge: ; preds = %for.inc21
57 br label %return.loopexit
59 return.loopexit: ; preds = %for.cond18.return.loopexit_crit_edge, %for.cond18thread-pre-split
62 return: ; preds = %return.loopexit, %cleanup