llvm/llvm/test/Transforms/LoopStrengthReduce/pr84709.ll

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

; Make sure it does not assert.
define i64 @test() {
; CHECK-LABEL: define i64 @test() {
; CHECK-NEXT:  bb:
; CHECK-NEXT:    br label [[BB1:%.*]]
; CHECK:       bb1:
; CHECK-NEXT:    br label [[BB2:%.*]]
; CHECK:       bb2:
; CHECK-NEXT:    br i1 true, label [[BB5:%.*]], label [[BB2]]
; CHECK:       bb5:
; CHECK-NEXT:    br label [[BB1]]
;
bb:
  br label %bb1

bb1:
  %phi = phi i8 [ %zext6, %bb5 ], [ 0, %bb ]
  br label %bb2

bb2:
  %phi3 = phi i8 [ %add, %bb2 ], [ %phi, %bb1 ]
  %phi4 = phi i32 [ 0, %bb2 ], [ 1, %bb1 ]
  %add = add i8 %phi3, 1
  br i1 true, label %bb5, label %bb2

bb5:
  %zext = zext i8 %add to i32
  %icmp = icmp sge i32 %phi4, 0
  %zext6 = zext i1 %icmp to i8
  br label %bb1
}