1; RUN: opt < %s -jump-threading -disable-output 2; PR2285 3target 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" 4target triple = "x86_64-unknown-linux-gnu" 5 %struct.system__secondary_stack__mark_id = type { i64, i64 } 6 7define void @_ada_c35507b() { 8entry: 9 br label %bb 10 11bb: ; preds = %bb13, %entry 12 %ch.0 = phi i8 [ 0, %entry ], [ 0, %bb13 ] ; <i8> [#uses=1] 13 %tmp11 = icmp ugt i8 %ch.0, 31 ; <i1> [#uses=1] 14 %tmp120 = call %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark( ) ; <%struct.system__secondary_stack__mark_id> [#uses=1] 15 br i1 %tmp11, label %bb110, label %bb13 16 17bb13: ; preds = %bb 18 br label %bb 19 20bb110: ; preds = %bb 21 %mrv_gr124 = extractvalue %struct.system__secondary_stack__mark_id %tmp120, 1 ; <i64> [#uses=0] 22 unreachable 23} 24 25declare %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark() 26 27 28 29define fastcc void @findratio(double* nocapture %res1, double* nocapture %res2) nounwind ssp { 30entry: 31 br label %bb12 32 33bb6.us: 34 %tmp = icmp eq i32 undef, undef 35 %tmp1 = fsub double undef, undef 36 %tmp2 = fcmp ult double %tmp1, 0.000000e+00 37 br i1 %tmp, label %bb6.us, label %bb13 38 39 40bb12: 41 %tmp3 = fcmp ult double undef, 0.000000e+00 42 br label %bb13 43 44bb13: 45 %.lcssa31 = phi double [ undef, %bb12 ], [ %tmp1, %bb6.us ] 46 %.lcssa30 = phi i1 [ %tmp3, %bb12 ], [ %tmp2, %bb6.us ] 47 br i1 %.lcssa30, label %bb15, label %bb61 48 49bb15: 50 %tmp4 = fsub double -0.000000e+00, %.lcssa31 51 ret void 52 53 54bb61: 55 ret void 56} 57 58 59; PR5258 60define i32 @test(i1 %cond, i1 %cond2, i32 %a) { 61A: 62 br i1 %cond, label %F, label %A1 63F: 64 br label %A1 65 66A1: 67 %d = phi i1 [false, %A], [true, %F] 68 %e = add i32 %a, %a 69 br i1 %d, label %B, label %G 70 71G: 72 br i1 %cond2, label %B, label %D 73 74B: 75 %f = phi i32 [%e, %G], [%e, %A1] 76 %b = add i32 0, 0 77 switch i32 %a, label %C [ 78 i32 7, label %D 79 i32 8, label %D 80 i32 9, label %D 81 ] 82 83C: 84 br label %D 85 86D: 87 %c = phi i32 [%e, %B], [%e, %B], [%e, %B], [%f, %C], [%e, %G] 88 ret i32 %c 89E: 90 ret i32 412 91} 92 93 94define i32 @test2() nounwind { 95entry: 96 br i1 true, label %decDivideOp.exit, label %bb7.i 97 98bb7.i: ; preds = %bb7.i, %entry 99 br label %bb7.i 100 101decDivideOp.exit: ; preds = %entry 102 ret i32 undef 103} 104 105 106; PR3298 107 108define i32 @test3(i32 %p_79, i32 %p_80) nounwind { 109entry: 110 br label %bb7 111 112bb1: ; preds = %bb2 113 br label %bb2 114 115bb2: ; preds = %bb7, %bb1 116 %l_82.0 = phi i8 [ 0, %bb1 ], [ %l_82.1, %bb7 ] ; <i8> [#uses=3] 117 br i1 true, label %bb3, label %bb1 118 119bb3: ; preds = %bb2 120 %0 = icmp eq i32 %p_80_addr.1, 0 ; <i1> [#uses=1] 121 br i1 %0, label %bb7, label %bb6 122 123bb5: ; preds = %bb6 124 %1 = icmp eq i8 %l_82.0, 0 ; <i1> [#uses=1] 125 br i1 %1, label %bb1.i, label %bb.i 126 127bb.i: ; preds = %bb5 128 br label %safe_div_func_char_s_s.exit 129 130bb1.i: ; preds = %bb5 131 br label %safe_div_func_char_s_s.exit 132 133safe_div_func_char_s_s.exit: ; preds = %bb1.i, %bb.i 134 br label %bb6 135 136bb6: ; preds = %safe_div_func_char_s_s.exit, %bb3 137 %p_80_addr.0 = phi i32 [ %p_80_addr.1, %bb3 ], [ 1, %safe_div_func_char_s_s.exit ] ; <i32> [#uses=2] 138 %2 = icmp eq i32 %p_80_addr.0, 0 ; <i1> [#uses=1] 139 br i1 %2, label %bb7, label %bb5 140 141bb7: ; preds = %bb6, %bb3, %entry 142 %l_82.1 = phi i8 [ 1, %entry ], [ %l_82.0, %bb3 ], [ %l_82.0, %bb6 ] ; <i8> [#uses=2] 143 %p_80_addr.1 = phi i32 [ 0, %entry ], [ %p_80_addr.1, %bb3 ], [ %p_80_addr.0, %bb6 ] ; <i32> [#uses=4] 144 %3 = icmp eq i32 %p_80_addr.1, 0 ; <i1> [#uses=1] 145 br i1 %3, label %bb8, label %bb2 146 147bb8: ; preds = %bb7 148 %4 = sext i8 %l_82.1 to i32 ; <i32> [#uses=0] 149 ret i32 0 150} 151 152 153; PR3353 154 155define i32 @test4(i8 %X) { 156entry: 157 %Y = add i8 %X, 1 158 %Z = add i8 %Y, 1 159 br label %bb33.i 160 161bb33.i: ; preds = %bb33.i, %bb32.i 162 switch i8 %Y, label %bb32.i [ 163 i8 39, label %bb35.split.i 164 i8 13, label %bb33.i 165 ] 166 167bb35.split.i: 168 ret i32 5 169bb32.i: 170 ret i32 1 171} 172 173 174define fastcc void @test5(i1 %tmp, i32 %tmp1) nounwind ssp { 175entry: 176 br i1 %tmp, label %bb12, label %bb13 177 178 179bb12: 180 br label %bb13 181 182bb13: 183 %.lcssa31 = phi i32 [ undef, %bb12 ], [ %tmp1, %entry ] 184 %A = and i1 undef, undef 185 br i1 %A, label %bb15, label %bb61 186 187bb15: 188 ret void 189 190 191bb61: 192 ret void 193} 194 195 196; PR5640 197define fastcc void @test6(i1 %tmp, i1 %tmp1) nounwind ssp { 198entry: 199 br i1 %tmp, label %bb12, label %bb14 200 201bb12: 202 br label %bb14 203 204bb14: 205 %A = phi i1 [ %A, %bb13 ], [ true, %bb12 ], [%tmp1, %entry] 206 br label %bb13 207 208bb13: 209 br i1 %A, label %bb14, label %bb61 210 211 212bb61: 213 ret void 214} 215 216 217; PR5698 218define void @test7(i32 %x) { 219entry: 220 br label %tailrecurse 221 222tailrecurse: 223 switch i32 %x, label %return [ 224 i32 2, label %bb2 225 i32 3, label %bb 226 ] 227 228bb: 229 switch i32 %x, label %return [ 230 i32 2, label %bb2 231 i32 3, label %tailrecurse 232 ] 233 234bb2: 235 ret void 236 237return: 238 ret void 239} 240 241; PR6119 242define i32 @test8(i32 %action) nounwind { 243entry: 244 switch i32 %action, label %lor.rhs [ 245 i32 1, label %if.then 246 i32 0, label %lor.end 247 ] 248 249if.then: ; preds = %for.cond, %lor.end, %entry 250 ret i32 undef 251 252lor.rhs: ; preds = %entry 253 br label %lor.end 254 255lor.end: ; preds = %lor.rhs, %entry 256 %cmp103 = xor i1 undef, undef ; <i1> [#uses=1] 257 br i1 %cmp103, label %for.cond, label %if.then 258 259for.cond: ; preds = %for.body, %lor.end 260 br i1 undef, label %if.then, label %for.body 261 262for.body: ; preds = %for.cond 263 br label %for.cond 264} 265 266; PR6119 267define i32 @test9(i32 %action) nounwind { 268entry: 269 switch i32 %action, label %lor.rhs [ 270 i32 1, label %if.then 271 i32 0, label %lor.end 272 ] 273 274if.then: ; preds = %for.cond, %lor.end, %entry 275 ret i32 undef 276 277lor.rhs: ; preds = %entry 278 br label %lor.end 279 280lor.end: ; preds = %lor.rhs, %entry 281 %0 = phi i1 [ undef, %lor.rhs ], [ true, %entry ] ; <i1> [#uses=1] 282 %cmp103 = xor i1 undef, %0 ; <i1> [#uses=1] 283 br i1 %cmp103, label %for.cond, label %if.then 284 285for.cond: ; preds = %for.body, %lor.end 286 br i1 undef, label %if.then, label %for.body 287 288for.body: ; preds = %for.cond 289 br label %for.cond 290} 291 292; PR6119 293define i32 @test10(i32 %action, i32 %type) nounwind { 294entry: 295 %cmp2 = icmp eq i32 %type, 0 ; <i1> [#uses=1] 296 switch i32 %action, label %lor.rhs [ 297 i32 1, label %if.then 298 i32 0, label %lor.end 299 ] 300 301if.then: ; preds = %for.cond, %lor.end, %entry 302 ret i32 undef 303 304lor.rhs: ; preds = %entry 305 %cmp101 = icmp eq i32 %action, 2 ; <i1> [#uses=1] 306 br label %lor.end 307 308lor.end: ; preds = %lor.rhs, %entry 309 %0 = phi i1 [ %cmp101, %lor.rhs ], [ true, %entry ] ; <i1> [#uses=1] 310 %cmp103 = xor i1 %cmp2, %0 ; <i1> [#uses=1] 311 br i1 %cmp103, label %for.cond, label %if.then 312 313for.cond: ; preds = %for.body, %lor.end 314 br i1 undef, label %if.then, label %for.body 315 316for.body: ; preds = %for.cond 317 br label %for.cond 318} 319 320 321; PR6305 322define void @test11() nounwind { 323entry: 324 br label %A 325 326A: ; preds = %entry 327 call void undef(i64 ptrtoint (i8* blockaddress(@test11, %A) to i64)) nounwind 328 unreachable 329} 330 331; PR6743 332define void @test12() nounwind ssp { 333entry: 334 br label %lbl_51 335 336lbl_51: ; preds = %if.then, %entry 337 %tmp3 = phi i1 [ false, %if.then ], [ undef, %entry ] ; <i1> [#uses=2] 338 br i1 %tmp3, label %if.end12, label %if.then 339 340if.then: ; preds = %lbl_51 341 br i1 %tmp3, label %lbl_51, label %if.end12 342 343if.end12: ; preds = %if.then, %lbl_51 344 ret void 345} 346 347 348 349; PR7356 350define i32 @test13(i32* %P, i8* %Ptr) { 351entry: 352 indirectbr i8* %Ptr, [label %BrBlock, label %B2] 353 354B2: 355 store i32 4, i32 *%P 356 br label %BrBlock 357 358BrBlock: 359 %L = load i32, i32* %P 360 %C = icmp eq i32 %L, 42 361 br i1 %C, label %T, label %F 362 363T: 364 ret i32 123 365F: 366 ret i32 1422 367} 368 369 370; PR7498 371define void @test14() nounwind { 372entry: 373 %cmp33 = icmp slt i8 undef, 0 ; <i1> [#uses=1] 374 %tobool = icmp eq i8 undef, 0 ; <i1> [#uses=1] 375 br i1 %tobool, label %land.end69, label %land.rhs 376 377land.rhs: ; preds = %entry 378 br label %land.end69 379 380land.end69: ; preds = %land.rhs, %entry 381 %0 = phi i1 [ undef, %land.rhs ], [ true, %entry ] ; <i1> [#uses=1] 382 %cmp71 = or i1 true, %0 ; <i1> [#uses=1] 383 %cmp73 = xor i1 %cmp33, %cmp71 ; <i1> [#uses=1] 384 br i1 %cmp73, label %if.then, label %if.end 385 386if.then: ; preds = %land.end69 387 ret void 388 389if.end: ; preds = %land.end69 390 ret void 391} 392 393; PR7647 394define void @test15() nounwind { 395entry: 396 ret void 397 398if.then237: 399 br label %lbl_664 400 401lbl_596: ; preds = %lbl_664, %for.end37 402 store volatile i64 undef, i64* undef, align 4 403 br label %for.cond111 404 405for.cond111: ; preds = %safe_sub_func_int64_t_s_s.exit, %lbl_596 406 %storemerge = phi i8 [ undef, %cond.true.i100 ], [ 22, %lbl_596 ] ; <i8> [#uses=1] 407 %l_678.5 = phi i64 [ %l_678.3, %cond.true.i100 ], [ undef, %lbl_596 ] ; <i64> [#uses=2] 408 %cmp114 = icmp slt i8 %storemerge, -2 ; <i1> [#uses=1] 409 br i1 %cmp114, label %lbl_664, label %if.end949 410 411lbl_664: ; preds = %for.end1058, %if.then237, %for.cond111 412 %l_678.3 = phi i64 [ %l_678.5, %for.cond111 ], [ %l_678.2, %for.cond1035 ], [ 5, %if.then237 ] ; <i64> [#uses=1] 413 %tobool118 = icmp eq i32 undef, 0 ; <i1> [#uses=1] 414 br i1 %tobool118, label %cond.true.i100, label %lbl_596 415 416cond.true.i100: ; preds = %for.inc120 417 br label %for.cond111 418 419lbl_709: 420 br label %if.end949 421 422for.cond603: ; preds = %for.body607, %if.end336 423 br i1 undef, label %for.cond603, label %if.end949 424 425if.end949: ; preds = %for.cond603, %lbl_709, %for.cond111 426 %l_678.2 = phi i64 [ %l_678.5, %for.cond111 ], [ undef, %lbl_709 ], [ 5, %for.cond603 ] ; <i64> [#uses=1] 427 br label %for.body1016 428 429for.body1016: ; preds = %for.cond1012 430 br label %for.body1016 431 432for.cond1035: ; preds = %for.inc1055, %if.then1026 433 br i1 undef, label %for.cond1040, label %lbl_664 434 435for.cond1040: ; preds = %for.body1044, %for.cond1035 436 ret void 437} 438 439; PR7755 440define void @test16(i1 %c, i1 %c2, i1 %c3, i1 %c4) nounwind ssp { 441entry: 442 %cmp = icmp sgt i32 undef, 1 ; <i1> [#uses=1] 443 br i1 %c, label %land.end, label %land.rhs 444 445land.rhs: ; preds = %entry 446 br i1 %c2, label %lor.lhs.false.i, label %land.end 447 448lor.lhs.false.i: ; preds = %land.rhs 449 br i1 %c3, label %land.end, label %land.end 450 451land.end: 452 %0 = phi i1 [ true, %entry ], [ false, %land.rhs ], [false, %lor.lhs.false.i], [false, %lor.lhs.false.i] ; <i1> [#uses=1] 453 %cmp12 = and i1 %cmp, %0 454 %xor1 = xor i1 %cmp12, %c4 455 br i1 %xor1, label %if.then, label %if.end 456 457if.then: 458 ret void 459 460if.end: 461 ret void 462} 463 464define void @test17() { 465entry: 466 br i1 undef, label %bb269.us.us, label %bb269.us.us.us 467 468bb269.us.us.us: 469 %indvar = phi i64 [ %indvar.next, %bb287.us.us.us ], [ 0, %entry ] 470 %0 = icmp eq i16 undef, 0 471 br i1 %0, label %bb287.us.us.us, label %bb286.us.us.us 472 473bb287.us.us.us: 474 %indvar.next = add i64 %indvar, 1 475 %exitcond = icmp eq i64 %indvar.next, 4 476 br i1 %exitcond, label %bb288.bb289.loopexit_crit_edge, label %bb269.us.us.us 477 478bb286.us.us.us: 479 unreachable 480 481bb269.us.us: 482 unreachable 483 484bb288.bb289.loopexit_crit_edge: 485 unreachable 486} 487 488; PR 8247 489%struct.S1 = type { i8, i8 } 490@func_89.l_245 = internal constant %struct.S1 { i8 33, i8 6 }, align 1 491define void @func_89(i16 zeroext %p_90, %struct.S1* nocapture %p_91, i32* nocapture %p_92) nounwind ssp { 492entry: 493 store i32 0, i32* %p_92, align 4 494 br i1 false, label %lbl_260, label %if.else 495 496if.else: ; preds = %entry 497 br label %for.cond 498 499for.cond: ; preds = %lbl_260, %if.else 500 %l_245.0 = phi i16 [ %l_245.1, %lbl_260 ], [ 33, %if.else ] 501 %l_261.0 = phi i32 [ %and, %lbl_260 ], [ 255, %if.else ] 502 %tobool21 = icmp ult i16 %l_245.0, 256 503 br i1 %tobool21, label %if.end, label %lbl_260 504 505lbl_260: ; preds = %for.cond, %entry 506 %l_245.1 = phi i16 [ 1569, %entry ], [ %l_245.0, %for.cond ] 507 %l_261.1 = phi i32 [ 255, %entry ], [ %l_261.0, %for.cond ] 508 %and = and i32 %l_261.1, 1 509 br label %for.cond 510 511if.end: ; preds = %for.cond 512 ret void 513} 514 515define void @PR14233(i1 %cmp, i1 %cmp2, i1 %cmp3, i1 %cmp4) { 516entry: 517 br i1 %cmp, label %cond.true, label %cond.false 518 519cond.true: 520 br label %if.end 521 522cond.false: 523 br label %if.end 524 525if.end: 526 %A = phi i64 [ 0, %cond.true ], [ 1, %cond.false ] 527 br i1 %cmp2, label %bb, label %if.end2 528 529bb: 530 br label %if.end2 531 532if.end2: 533 %B = phi i64 [ ptrtoint (i8* ()* @PR14233.f1 to i64), %bb ], [ %A, %if.end ] 534 %cmp.ptr = icmp eq i64 %B, ptrtoint (i8* ()* @PR14233.f2 to i64) 535 br i1 %cmp.ptr, label %cond.true2, label %if.end3 536 537cond.true2: 538 br i1 %cmp3, label %bb2, label %ur 539 540bb2: 541 br i1 %cmp4, label %if.end4, label %if.end3 542 543if.end4: 544 unreachable 545 546if.end3: 547 %cmp.ptr2 = icmp eq i64 %B, ptrtoint (i8* ()* @PR14233.f2 to i64) 548 br i1 %cmp.ptr2, label %ur, label %if.then601 549 550if.then601: 551 %C = icmp eq i64 %B, 0 552 br i1 %C, label %bb3, label %bb4 553 554bb3: 555 unreachable 556 557bb4: 558 unreachable 559 560ur: 561 unreachable 562} 563 564declare i8* @PR14233.f1() 565 566declare i8* @PR14233.f2() 567