337 lines · plain
1; RUN: llc < %s -mtriple=avr -mcpu=avr5 | FileCheck %s2 3; The original reason for this failure is that the BranchFolderPass disables liveness4; tracking unless you override the trackLivenessAfterRegAlloc function and return true.5; This probably should be the default because all main targets do this (maybe some gpu targets don't).6 7; More info can be found at https://github.com/avr-rust/rust/issues/99.8 9%struct.quux = type { [0 x i8], i64, [0 x i8], i64, [0 x i8], i64, [0 x i8], i64, [0 x i8] }10%struct.foo = type { [0 x i8], %struct.blam, [0 x i8], i32, [0 x i8], i32, [0 x i8], i8, [0 x i8], %struct.blam.0, [0 x i8], %struct.blam.0, [0 x i8] }11%struct.blam = type {}12%struct.blam.0 = type { [0 x i8], i8, [2 x i8] }13%struct.quux.1 = type { [0 x i8], %struct.wombat, [0 x i8], i64, [0 x i8], i64, [0 x i8], i16, [0 x i8], %struct.quux, [0 x i8], i64, [0 x i8], i16, [0 x i8] }14%struct.wombat = type {}15 16declare zeroext i1 @zot(ptr, ptr)17 18declare void @wibble(i16, i16)19 20; CHECK-LABEL: main21define zeroext i1 @main(ptr %arg, ptr %arg62) {22bb:23 %tmp63 = alloca [128 x i8], align 124 %tmp = getelementptr inbounds %struct.quux.1, ptr %arg, i16 0, i32 525 %tmp64 = getelementptr inbounds %struct.quux.1, ptr %arg, i16 0, i32 1326 %tmp65 = bitcast ptr %arg62 to ptr27 %tmp66 = icmp eq i32 undef, 028 br i1 undef, label %bb92, label %bb6729 30bb67:31 br i1 %tmp66, label %bb83, label %bb6832 33bb68:34 %tmp69 = load i64, ptr null, align 135 br label %bb7036 37bb70:38 %tmp71 = phi i16 [ 128, %bb68 ], [ %tmp79, %bb70 ]39 %tmp72 = phi i64 [ %tmp69, %bb68 ], [ %tmp74, %bb70 ]40 %tmp73 = getelementptr inbounds i8, ptr null, i16 -141 %tmp74 = lshr i64 %tmp72, 442 %tmp75 = trunc i64 %tmp72 to i843 %tmp76 = and i8 %tmp75, 1544 %tmp77 = add nuw nsw i8 %tmp76, 8745 %tmp78 = select i1 undef, i8 undef, i8 %tmp7746 store i8 %tmp78, ptr %tmp73, align 147 %tmp79 = add nsw i16 %tmp71, -148 %tmp80 = icmp eq ptr %tmp73, null49 %tmp81 = or i1 undef, %tmp8050 br i1 %tmp81, label %bb82, label %bb7051 52bb82:53 call void @wibble(i16 %tmp79, i16 128)54 unreachable55 56bb83:57 %tmp84 = icmp eq i32 undef, 058 %tmp85 = load i64, ptr null, align 159 br i1 %tmp84, label %bb87, label %bb8660 61bb86:62 unreachable63 64bb87:65 br label %bb8866 67bb88:68 %tmp89 = phi i64 [ %tmp90, %bb88 ], [ %tmp85, %bb87 ]69 %tmp90 = udiv i64 %tmp89, 1000070 %tmp91 = icmp ugt i64 %tmp89, 9999999971 br label %bb8872 73bb92:74 br label %bb9375 76bb93:77 br i1 undef, label %bb95, label %bb9478 79bb94:80 unreachable81 82bb95:83 br label %bb9684 85bb96:86 %tmp97 = phi i64 [ %tmp98, %bb96 ], [ undef, %bb95 ]87 %tmp98 = udiv i64 %tmp97, 1000088 %tmp99 = icmp ugt i64 %tmp97, 9999999989 br i1 %tmp99, label %bb96, label %bb10090 91bb100:92 br label %bb10193 94bb101:95 %tmp102 = and i32 undef, 1696 %tmp103 = icmp eq i32 %tmp102, 097 br i1 undef, label %bb130, label %bb10498 99bb104:100 br i1 %tmp103, label %bb117, label %bb105101 102bb105:103 br label %bb106104 105bb106:106 %tmp107 = phi i16 [ 128, %bb105 ], [ %tmp113, %bb106 ]107 %tmp108 = phi i64 [ undef, %bb105 ], [ %tmp111, %bb106 ]108 %tmp109 = phi ptr [ undef, %bb105 ], [ %tmp110, %bb106 ]109 %tmp110 = getelementptr inbounds i8, ptr %tmp109, i16 -1110 %tmp111 = lshr i64 %tmp108, 4111 %tmp112 = trunc i64 %tmp108 to i8112 %tmp113 = add nsw i16 %tmp107, -1113 %tmp114 = icmp eq ptr %tmp110, null114 %tmp115 = or i1 undef, %tmp114115 br i1 %tmp115, label %bb116, label %bb106116 117bb116:118 call void @wibble(i16 %tmp113, i16 128)119 unreachable120 121bb117:122 %tmp118 = load i64, ptr %tmp, align 1123 br i1 undef, label %bb120, label %bb119124 125bb119:126 unreachable127 128bb120:129 %tmp121 = icmp ugt i64 %tmp118, 9999130 br i1 %tmp121, label %bb122, label %bb127131 132bb122:133 br label %bb123134 135bb123:136 %tmp124 = phi i64 [ %tmp125, %bb123 ], [ %tmp118, %bb122 ]137 %tmp125 = udiv i64 %tmp124, 10000138 %tmp126 = icmp ugt i64 %tmp124, 99999999139 br label %bb123140 141bb127:142 %tmp128 = load i32, ptr %tmp65, align 1143 %tmp129 = icmp eq i32 undef, 0144 br label %bb162145 146bb130:147 br i1 %tmp103, label %bb142, label %bb131148 149bb131:150 br label %bb132151 152bb132:153 %tmp133 = phi i64 [ undef, %bb131 ], [ %tmp134, %bb132 ]154 %tmp134 = lshr i64 %tmp133, 4155 %tmp135 = trunc i64 %tmp133 to i8156 %tmp136 = and i8 %tmp135, 15157 %tmp137 = add nuw nsw i8 %tmp136, 87158 %tmp138 = select i1 undef, i8 undef, i8 %tmp137159 store i8 %tmp138, ptr undef, align 1160 %tmp139 = icmp eq ptr undef, null161 %tmp140 = or i1 undef, %tmp139162 br i1 %tmp140, label %bb141, label %bb132163 164bb141:165 unreachable166 167bb142:168 %tmp143 = icmp eq i32 undef, 0169 %tmp144 = load i64, ptr %tmp, align 1170 br i1 %tmp143, label %bb156, label %bb145171 172bb145:173 br label %bb146174 175bb146:176 %tmp147 = phi i16 [ 128, %bb145 ], [ %tmp151, %bb146 ]177 %tmp148 = phi i64 [ %tmp144, %bb145 ], [ %tmp150, %bb146 ]178 %tmp149 = getelementptr inbounds i8, ptr null, i16 -1179 %tmp150 = lshr i64 %tmp148, 4180 %tmp151 = add nsw i16 %tmp147, -1181 %tmp152 = icmp eq i64 %tmp150, 0182 %tmp153 = icmp eq ptr %tmp149, null183 %tmp154 = or i1 %tmp152, %tmp153184 br i1 %tmp154, label %bb155, label %bb146185 186bb155:187 call void @wibble(i16 %tmp151, i16 128)188 unreachable189 190bb156:191 br label %bb157192 193bb157:194 %tmp158 = phi i64 [ %tmp159, %bb157 ], [ %tmp144, %bb156 ]195 %tmp159 = udiv i64 %tmp158, 10000196 %tmp160 = icmp ugt i64 %tmp158, 99999999197 br i1 %tmp160, label %bb157, label %bb161198 199bb161:200 unreachable201 202bb162:203 br i1 %tmp129, label %bb164, label %bb163204 205bb163:206 unreachable207 208bb164:209 %tmp165 = and i32 %tmp128, 32210 %tmp166 = icmp eq i32 %tmp165, 0211 br i1 %tmp166, label %bb169, label %bb167212 213bb167:214 br label %bb168215 216bb168:217 br label %bb168218 219bb169:220 br label %bb170221 222bb170:223 br i1 undef, label %bb172, label %bb171224 225bb171:226 store i32 0, ptr undef, align 1227 call void @llvm.memcpy.p0.p0.i16(ptr align 1 undef, ptr align 1 null, i16 3, i1 false)228 call void @llvm.memcpy.p0.p0.i16(ptr align 1 undef, ptr align 1 null, i16 3, i1 false)229 br label %bb214230 231bb172:232 %tmp173 = call zeroext i1 @zot(ptr noalias nonnull readonly dereferenceable(32) undef, ptr nonnull dereferenceable(15) %arg62)233 br i1 %tmp173, label %bb214, label %bb174234 235bb174:236 %tmp175 = load i32, ptr %tmp65, align 1237 %tmp176 = icmp eq i32 undef, 0238 br label %bb177239 240bb177:241 br i1 %tmp176, label %bb190, label %bb178242 243bb178:244 %tmp179 = getelementptr inbounds [128 x i8], ptr %tmp63, i16 0, i16 0245 br label %bb180246 247bb180:248 %tmp181 = phi i64 [ 0, %bb178 ], [ %tmp182, %bb180 ]249 %tmp182 = lshr i64 %tmp181, 4250 %tmp183 = trunc i64 %tmp181 to i8251 %tmp184 = and i8 %tmp183, 15252 %tmp185 = add nuw nsw i8 %tmp184, 87253 %tmp186 = select i1 false, i8 0, i8 %tmp185254 store i8 %tmp186, ptr null, align 1255 %tmp187 = icmp eq ptr null, %tmp179256 %tmp188 = or i1 undef, %tmp187257 br i1 %tmp188, label %bb189, label %bb180258 259bb189:260 call void @wibble(i16 0, i16 128)261 unreachable262 263bb190:264 %tmp191 = and i32 %tmp175, 32265 %tmp192 = icmp eq i32 %tmp191, 0266 br i1 %tmp192, label %bb201, label %bb193267 268bb193:269 br label %bb194270 271bb194:272 %tmp195 = phi i64 [ 0, %bb193 ], [ %tmp196, %bb194 ]273 %tmp196 = lshr i64 %tmp195, 4274 %tmp197 = add nsw i16 0, -1275 %tmp198 = icmp eq i64 %tmp196, 0276 %tmp199 = or i1 %tmp198, undef277 br i1 %tmp199, label %bb200, label %bb194278 279bb200:280 call void @wibble(i16 %tmp197, i16 128)281 unreachable282 283bb201:284 br i1 undef, label %bb202, label %bb207285 286bb202:287 br label %bb203288 289bb203:290 %tmp204 = phi i64 [ %tmp205, %bb203 ], [ 0, %bb202 ]291 %tmp205 = udiv i64 %tmp204, 10000292 %tmp206 = icmp ugt i64 %tmp204, 99999999293 br i1 %tmp206, label %bb203, label %bb207294 295bb207:296 br label %bb208297 298bb208:299 store ptr %tmp64, ptr undef, align 1300 %tmp209 = load i32, ptr %tmp65, align 1301 %tmp210 = icmp eq i32 undef, 0302 %tmp211 = and i32 %tmp209, 16303 %tmp212 = icmp eq i32 %tmp211, 0304 br i1 %tmp210, label %bb215, label %bb213305 306bb213:307 unreachable308 309bb214:310 br label %bb221311 312bb215:313 br i1 %tmp212, label %bb220, label %bb216314 315bb216:316 br label %bb217317 318bb217:319 br i1 undef, label %bb218, label %bb219320 321bb218:322 unreachable323 324bb219:325 br label %bb221326 327bb220:328 unreachable329 330bb221:331 store ptr %arg, ptr undef, align 1332 ret i1 undef333}334 335declare void @llvm.memcpy.p0.p0.i16(ptr nocapture writeonly, ptr nocapture readonly, i16, i1)336 337