llvm/llvm/test/Transforms/LoopUnroll/dce.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=loop-unroll -S < %s | FileCheck %s

; Can't recursively delete %c.addr.07 without deleting %conv1
; and thus invalidating iteration.
define void @PR50368(i32 %c, i64 %x) {
; CHECK-LABEL: @PR50368(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br label [[LOOP_PEEL_BEGIN:%.*]]
; CHECK:       loop.peel.begin:
; CHECK-NEXT:    br label [[LOOP_PEEL:%.*]]
; CHECK:       loop.peel:
; CHECK-NEXT:    br i1 false, label [[EXIT:%.*]], label [[LOOP_PEEL_NEXT:%.*]]
; CHECK:       loop.peel.next:
; CHECK-NEXT:    br label [[LOOP_PEEL_NEXT1:%.*]]
; CHECK:       loop.peel.next1:
; CHECK-NEXT:    br label [[ENTRY_PEEL_NEWPH:%.*]]
; CHECK:       entry.peel.newph:
; CHECK-NEXT:    br label [[LOOP:%.*]]
; CHECK:       loop:
; CHECK-NEXT:    br i1 false, label [[EXIT_LOOPEXIT:%.*]], label [[LOOP]], !llvm.loop [[LOOP0:![0-9]+]]
; CHECK:       exit.loopexit:
; CHECK-NEXT:    br label [[EXIT]]
; CHECK:       exit:
; CHECK-NEXT:    ret void
;
entry:
  br label %loop

loop:
  %0 = phi i64 [ 0, %loop ], [ %x, %entry ]
  %c.addr.07 = phi i32 [ %conv1, %loop ], [ %c, %entry ]
  %conv1 = trunc i64 undef to i32
  br i1 false, label %exit, label %loop

exit:
  ret void
}


define void @dead_chain(i64 %a) {
; CHECK-LABEL: @dead_chain(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br label [[LOOP:%.*]]
; CHECK:       loop:
; CHECK-NEXT:    ret void
;
entry:
  br label %loop

loop:
  %conv1 = trunc i64 %a to i32
  %and = and i32 %conv1, 15
  %shl = shl i32 %and, 15
  br i1 true, label %exit, label %loop

exit:
  ret void
}