1 ; RUN: opt -gvn %s -disable-output
5 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
6 target triple = "x86_64-apple-darwin10.0"
8 define i32* @test1(i8* %name, i32 %namelen, i32* %o, i32 %expected_type) nounwind ssp {
10 br i1 undef, label %if.end13, label %while.body.preheader
13 if.end13: ; preds = %if.then6
14 br label %while.body.preheader
16 while.body.preheader: ; preds = %if.end13, %if.end
19 while.body: ; preds = %while.body.backedge, %while.body.preheader
20 %o.addr.0 = phi i32* [ undef, %while.body.preheader ], [ %o.addr.0.be, %while.body.backedge ] ; <i32*> [#uses=2]
21 br i1 false, label %return.loopexit, label %lor.lhs.false
23 lor.lhs.false: ; preds = %while.body
24 %tmp20 = bitcast i32* %o.addr.0 to i32* ; <i32*> [#uses=1]
25 %tmp22 = load i32* %tmp20 ; <i32> [#uses=0]
26 br i1 undef, label %land.lhs.true24, label %if.end31
28 land.lhs.true24: ; preds = %lor.lhs.false
29 %call28 = call i32* @parse_object(i8* undef) nounwind ; <i32*> [#uses=0]
30 br i1 undef, label %return.loopexit, label %if.end31
32 if.end31: ; preds = %land.lhs.true24, %lor.lhs.false
33 br i1 undef, label %return.loopexit, label %if.end41
35 if.end41: ; preds = %if.end31
36 %tmp43 = bitcast i32* %o.addr.0 to i32* ; <i32*> [#uses=1]
37 %tmp45 = load i32* %tmp43 ; <i32> [#uses=0]
38 br i1 undef, label %if.then50, label %if.else
40 if.then50: ; preds = %if.end41
41 %tmp53 = load i32** undef ; <i32*> [#uses=1]
42 br label %while.body.backedge
44 if.else: ; preds = %if.end41
45 br i1 undef, label %if.then62, label %if.else67
47 if.then62: ; preds = %if.else
48 br label %while.body.backedge
50 while.body.backedge: ; preds = %if.then62, %if.then50
51 %o.addr.0.be = phi i32* [ %tmp53, %if.then50 ], [ undef, %if.then62 ] ; <i32*> [#uses=1]
54 if.else67: ; preds = %if.else
57 return.loopexit: ; preds = %if.end31, %land.lhs.true24, %while.body
61 declare i32* @parse_object(i8*)
68 %struct.attribute_spec = type { i8*, i32, i32, i8, i8, i8 }
70 @attribute_tables = external global [4 x %struct.attribute_spec*] ; <[4 x %struct.attribute_spec*]*> [#uses=2]
72 define void @test2() nounwind {
76 bb69.i: ; preds = %bb57.i.preheader
77 %tmp4 = getelementptr inbounds [4 x %struct.attribute_spec*]* @attribute_tables, i32 0, i32 undef ; <%struct.attribute_spec**> [#uses=1]
78 %tmp3 = load %struct.attribute_spec** %tmp4, align 4 ; <%struct.attribute_spec*> [#uses=1]
81 bb65.i: ; preds = %bb65.i.preheader, %bb64.i
82 %storemerge6.i = phi i32 [ 1, %bb64.i ], [ 0, %bb69.i ] ; <i32> [#uses=3]
83 %scevgep14 = getelementptr inbounds %struct.attribute_spec* %tmp3, i32 %storemerge6.i, i32 0 ; <i8**> [#uses=1]
84 %tmp2 = load i8** %scevgep14, align 4 ; <i8*> [#uses=0]
85 %tmp = load %struct.attribute_spec** %tmp4, align 4 ; <%struct.attribute_spec*> [#uses=1]
86 %scevgep1516 = getelementptr inbounds %struct.attribute_spec* %tmp, i32 %storemerge6.i, i32 0 ; <i8**> [#uses=0]
100 @g = external global i64, align 8
102 define i32* @test3() {
104 %tmp18.i = load i7** undef
105 %tmp1 = bitcast i7* %tmp18.i to i8*
106 br i1 undef, label %do.body36.i, label %if.then21.i
109 %tmp2 = bitcast i7* %tmp18.i to i8*
113 %ivar38.i = load i64* @g
114 %tmp3 = bitcast i7* %tmp18.i to i8*
115 %add.ptr39.sum.i = add i64 %ivar38.i, 8
116 %tmp40.i = getelementptr inbounds i8* %tmp3, i64 %add.ptr39.sum.i
117 %tmp4 = bitcast i8* %tmp40.i to i64*
118 %tmp41.i = load i64* %tmp4
119 br i1 undef, label %if.then48.i, label %do.body57.i
122 %call54.i = call i32 @foo2()
123 br label %do.body57.i
126 %tmp58.i = load i7** undef
127 %ivar59.i = load i64* @g
128 %tmp5 = bitcast i7* %tmp58.i to i8*
129 %add.ptr65.sum.i = add i64 %ivar59.i, 8
130 %tmp66.i = getelementptr inbounds i8* %tmp5, i64 %add.ptr65.sum.i
131 %tmp6 = bitcast i8* %tmp66.i to i64*
132 %tmp67.i = load i64* %tmp6
140 define i32 @test4() {
145 %P2 = getelementptr i32 *%P2, i32 52
146 %Q2 = getelementptr i32 *%Q2, i32 52
147 store i32 4, i32* %P2
149 br i1 true, label %dead, label %dead2