1 ; RUN: opt -passes=newgvn -disable-output < %s
3 define void @test(i1 %arg, i1 %arg1) {
5 %alloca = alloca i64, i32 0, align 8
6 %alloca2 = alloca i64, i32 0, align 8
7 %load = load i64, ptr null, align 8
8 %icmp = icmp ult i64 0, %load
9 br i1 %icmp, label %bb24, label %bb25
15 store i64 %load, ptr %alloca, align 8
16 %load26 = load i64, ptr addrspace(1) null, align 8
17 %icmp27 = icmp ugt i64 %load26, 1
18 br i1 %icmp27, label %bb28, label %bb29
24 %icmp30 = icmp ugt i64 %load26, 0
25 br i1 %icmp30, label %bb34, label %bb31
27 bb31: ; preds = %bb38, %bb29
28 %load32 = load i64, ptr addrspace(1) null, align 8
29 %icmp33 = icmp ugt i64 %load32, 1
30 br i1 %icmp33, label %bb42, label %bb43
33 %load35 = load i64, ptr addrspace(1) null, align 8
34 store i64 %load35, ptr null, align 8
35 %load36 = load i64, ptr null, align 8
38 bb37: ; preds = %bb37, %bb34
39 %phi = phi i64 [ 0, %bb37 ], [ %load36, %bb34 ]
40 %inttoptr = inttoptr i64 %phi to ptr addrspace(1)
41 br i1 false, label %bb37, label %bb38
44 %load39 = load i64, ptr null, align 8
45 %inttoptr40 = inttoptr i64 %load39 to ptr addrspace(1)
46 %load41 = load i64, ptr addrspace(1) %inttoptr40, align 8
47 %shl = shl i64 %load26, 0
48 %and = and i64 %shl, 0
55 %load44 = load i64, ptr null, align 8
56 %load45 = load i64, ptr null, align 8
57 %icmp46 = icmp ugt i64 1, %load45
58 br i1 %icmp46, label %bb51, label %bb60
60 bb47: ; preds = %bb60, %bb55, %bb51
61 %load48 = load i64, ptr %alloca, align 8
62 %inttoptr49 = inttoptr i64 %load48 to ptr addrspace(1)
63 %load50 = load i64, ptr addrspace(1) %inttoptr49, align 8
64 br i1 %arg, label %bb63, label %bb75
67 %load52 = load i64, ptr addrspace(1) null, align 8
68 store i64 %load52, ptr %alloca2, align 8
69 %load53 = load i64, ptr null, align 8
70 store i64 %load53, ptr null, align 8
71 %icmp54 = icmp ult i64 0, %load32
72 br i1 %icmp54, label %bb55, label %bb47
75 %load56 = load i64, ptr null, align 8
76 %or = or i64 %load56, 0
77 %inttoptr57 = inttoptr i64 %or to ptr addrspace(1)
78 %load58 = load i64, ptr addrspace(1) %inttoptr57, align 8
79 %and59 = and i64 %load32, 0
83 %or61 = or i64 %load44, 0
84 %load62 = load i64, ptr addrspace(1) null, align 8
85 store i64 %load62, ptr null, align 8
89 %load64 = load i64, ptr addrspace(1) inttoptr (i64 64 to ptr addrspace(1)), align 8
90 %inttoptr65 = inttoptr i64 %load64 to ptr addrspace(1)
91 store i64 0, ptr addrspace(1) %inttoptr65, align 8
92 %or66 = or i64 %load64, 4
93 %inttoptr67 = inttoptr i64 %or66 to ptr addrspace(1)
94 store i64 0, ptr addrspace(1) %inttoptr67, align 8
95 %or68 = or i64 %load64, 36
96 %inttoptr69 = inttoptr i64 %or68 to ptr addrspace(1)
97 store i64 0, ptr addrspace(1) %inttoptr69, align 8
98 %or70 = or i64 %load64, 68
99 %inttoptr71 = inttoptr i64 %or70 to ptr addrspace(1)
100 store i64 0, ptr addrspace(1) %inttoptr71, align 8
101 %load72 = load i64, ptr null, align 8
102 %shl73 = shl i64 %load72, 0
103 %or74 = or i64 %shl73, 0
104 store i64 %or74, ptr null, align 8
107 bb75: ; preds = %bb47
108 br i1 %arg1, label %bb88, label %bb76
110 bb76: ; preds = %bb75
111 %load77 = load i64, ptr addrspace(1) inttoptr (i64 64 to ptr addrspace(1)), align 8
112 %inttoptr78 = inttoptr i64 %load77 to ptr addrspace(1)
113 store i64 0, ptr addrspace(1) %inttoptr78, align 8
114 %or79 = or i64 %load77, 4
115 %inttoptr80 = inttoptr i64 %or79 to ptr addrspace(1)
116 store i64 0, ptr addrspace(1) %inttoptr80, align 8
117 %or81 = or i64 %load77, 36
118 %inttoptr82 = inttoptr i64 %or81 to ptr addrspace(1)
119 store i64 0, ptr addrspace(1) %inttoptr82, align 8
120 %or83 = or i64 %load77, 68
121 %inttoptr84 = inttoptr i64 %or83 to ptr addrspace(1)
122 store i64 0, ptr addrspace(1) %inttoptr84, align 8
123 %load85 = load i64, ptr null, align 8
124 %shl86 = shl i64 %load85, 0
125 %or87 = or i64 %shl86, 0
126 store i64 %or87, ptr null, align 8
129 bb88: ; preds = %bb75
130 %load89 = load i64, ptr addrspace(1) null, align 8
131 %icmp90 = icmp ugt i64 %load89, 0
132 br i1 %icmp90, label %bb91, label %bb92
134 bb91: ; preds = %bb88
137 bb92: ; preds = %bb88
138 br i1 false, label %bb93, label %bb95
140 bb93: ; preds = %bb93, %bb92
141 %phi94 = phi i64 [ 0, %bb93 ], [ %load89, %bb92 ]
144 bb95: ; preds = %bb92
145 %load96 = load i64, ptr null, align 8
148 bb97: ; preds = %bb98
151 bb98: ; preds = %bb98, %bb95
152 %phi99 = phi i64 [ %load96, %bb95 ], [ 0, %bb98 ]
153 %inttoptr100 = inttoptr i64 %phi99 to ptr
154 %load101 = load i64, ptr %inttoptr100, align 8
155 br i1 false, label %bb98, label %bb97