1*fe9bdd96SRoman Lebedev; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -disable-output
2cee313d2SEric Christopher; END.
3cee313d2SEric Christopher
4cee313d2SEric Christophertarget datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
5cee313d2SEric Christophertarget triple = "thumbv7-apple-ios9.0.0"
6cee313d2SEric Christopher
7cee313d2SEric Christopher%struct.anon = type { %struct.anon.0, i32, i32, %union.T1 }
8cee313d2SEric Christopher%struct.anon.0 = type { i32, [256 x i32], [256 x i8] }
9cee313d2SEric Christopher%union.T1 = type { %struct.F}
10cee313d2SEric Christopher%struct.F = type { i32 }
11cee313d2SEric Christopher
12cee313d2SEric Christopher@U = internal global %struct.anon zeroinitializer, align 4
13cee313d2SEric Christopher
14cee313d2SEric Christopherdefine void @main() {
15cee313d2SEric Christopherentry:
16cee313d2SEric Christopher  %0 = load i32, i32* getelementptr inbounds (%struct.anon, %struct.anon* @U, i32 0, i32 2), align 4
17cee313d2SEric Christopher  %cmp.i = icmp eq i32 %0, -1
18cee313d2SEric Christopher  br i1 %cmp.i, label %if.then, label %if.end
19cee313d2SEric Christopher
20cee313d2SEric Christopherif.then:                                          ; preds = %entry
21cee313d2SEric Christopher  br label %if.end
22cee313d2SEric Christopher
23cee313d2SEric Christopherif.end:                                           ; preds = %entry, %if.then
24cee313d2SEric Christopher  %1 = load i32, i32* getelementptr inbounds (%struct.anon, %struct.anon* @U, i32 0, i32 2), align 4
25cee313d2SEric Christopher  %bf.load = load i32, i32* getelementptr inbounds (%struct.anon, %struct.anon* @U, i32 0, i32 3, i32 0, i32 0), align 4
26cee313d2SEric Christopher  %cmp = icmp slt i32 %0, 0
27cee313d2SEric Christopher  br i1 %cmp, label %if.end7, label %cond.false
28cee313d2SEric Christopher
29cee313d2SEric Christophercond.false:                                       ; preds = %if.end
30cee313d2SEric Christopher  %add = and i32 %bf.load, 30
31cee313d2SEric Christopher  %shl = add nuw nsw i32 %add, 2
32cee313d2SEric Christopher  br label %if.end7
33cee313d2SEric Christopher
34cee313d2SEric Christopherif.end7:                                          ; preds = %if.end, %cond.false
35cee313d2SEric Christopher  %2 = icmp eq i32 %0, 1
36cee313d2SEric Christopher  br i1 %2, label %if.then9, label %if.else10
37cee313d2SEric Christopher
38cee313d2SEric Christopherif.then9:                                         ; preds = %if.end7
39cee313d2SEric Christopher  br label %if.end29
40cee313d2SEric Christopher
41cee313d2SEric Christopherif.else10:                                        ; preds = %if.end7
42cee313d2SEric Christopher  %cmp11 = icmp ugt i32 %0, 13
43cee313d2SEric Christopher  br i1 %cmp11, label %if.then12, label %if.else14
44cee313d2SEric Christopher
45cee313d2SEric Christopherif.then12:                                        ; preds = %if.else10
46cee313d2SEric Christopher  br label %if.end26
47cee313d2SEric Christopher
48cee313d2SEric Christopherif.else14:                                        ; preds = %if.else10
49cee313d2SEric Christopher  %tobool = icmp eq i1 %2, 0
50cee313d2SEric Christopher  br i1 %tobool, label %lor.rhs, label %if.then18
51cee313d2SEric Christopher
52cee313d2SEric Christopherlor.rhs:                                          ; preds = %if.else14
53cee313d2SEric Christopher  %tobool.not.i = icmp eq i1 %2, 0
54cee313d2SEric Christopher  br i1 %tobool.not.i, label %if.else21, label %if.end.i54
55cee313d2SEric Christopher
56cee313d2SEric Christopherif.end.i54:                                       ; preds = %lor.rhs
57cee313d2SEric Christopher  br label %for.cond.i
58cee313d2SEric Christopher
59cee313d2SEric Christopherfor.cond.i:                                       ; preds = %if.end6.i, %if.end.i54
60cee313d2SEric Christopher  %ix.0.i = phi i32 [ 0, %if.end.i54 ], [ %inc.i55, %if.end6.i ]
61cee313d2SEric Christopher  %ret.0.off0.i = phi i1 [ false, %if.end.i54 ], [ %.ret.0.off0.i, %if.end6.i ]
62cee313d2SEric Christopher  %cmp2.i = icmp ult i32 %ix.0.i, 2
63cee313d2SEric Christopher  br i1 %cmp2.i, label %for.body.i, label %TmpSimpleNeedExt.exit
64cee313d2SEric Christopher
65cee313d2SEric Christopherfor.body.i:                                       ; preds = %for.cond.i
66cee313d2SEric Christopher  %arrayidx.i = getelementptr inbounds %struct.anon, %struct.anon* @U, i32 0, i32 0, i32 2, i32 %ix.0.i
67cee313d2SEric Christopher  %elt = load i8, i8* %arrayidx.i, align 1
68cee313d2SEric Christopher  %cmp3.i = icmp sgt i8 %elt, 7
69cee313d2SEric Christopher  br i1 %cmp3.i, label %if.else21, label %if.end6.i
70cee313d2SEric Christopher
71cee313d2SEric Christopherif.end6.i:                                        ; preds = %for.body.i
72cee313d2SEric Christopher  %cmp10.i = icmp ugt i8 %elt, 59
73cee313d2SEric Christopher  %.ret.0.off0.i = or i1 %ret.0.off0.i, %cmp10.i
74cee313d2SEric Christopher  %inc.i55 = add i32 %ix.0.i, 1
75cee313d2SEric Christopher  br label %for.cond.i
76cee313d2SEric Christopher
77cee313d2SEric ChristopherTmpSimpleNeedExt.exit:                            ; preds = %for.body.i
78cee313d2SEric Christopher  br i1 %ret.0.off0.i, label %if.then18, label %if.else21
79cee313d2SEric Christopher
80cee313d2SEric Christopherif.then18:                                        ; preds = %if.else14, %TmpSimpleNeedExt.exit
81cee313d2SEric Christopher  br label %if.end26
82cee313d2SEric Christopher
83cee313d2SEric Christopherif.else21:                                        ; preds = %for.body.i, %lor.rhs, %TmpSimpleNeedExt.exit
84cee313d2SEric Christopher  br label %if.end26
85cee313d2SEric Christopher
86cee313d2SEric Christopherif.end26:                                         ; preds = %if.then18, %if.else21, %if.then12
87cee313d2SEric Christopher  %cmp.i51 = icmp slt i32 %0, 7
88cee313d2SEric Christopher  br i1 %cmp.i51, label %if.then.i, label %if.end.i
89cee313d2SEric Christopher
90cee313d2SEric Christopherif.then.i:                                        ; preds = %if.end26
91cee313d2SEric Christopher  br label %if.end.i
92cee313d2SEric Christopher
93cee313d2SEric Christopherif.end.i:                                         ; preds = %if.then.i, %if.end26
94cee313d2SEric Christopher  br label %if.end29
95cee313d2SEric Christopher
96cee313d2SEric Christopherif.then2.i:                                       ; preds = %if.end.i
97cee313d2SEric Christopher  br label %if.end29
98cee313d2SEric Christopher
99cee313d2SEric Christopherif.end29:                                         ; preds = %if.end.i, %if.then2.i, %if.then9
100cee313d2SEric Christopher  ret void
101cee313d2SEric Christopher}
102