llvm/llvm/test/Transforms/PhaseOrdering/d83507-knowledge-retention-bug.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes='loop(loop-rotate),instcombine' -enable-knowledge-retention -S < %s  | FileCheck %s

%0 = type { ptr }

define ptr @f1(ptr %i0) local_unnamed_addr {
; CHECK-LABEL: @f1(
; CHECK-NEXT:  bb:
; CHECK:         br label [[BB3:%.*]]
; CHECK:       bb3:
; CHECK-NEXT:    [[I1:%.*]] = phi ptr [ %i0, [[BB:%.*]] ], [ [[I5:%.*]], [[BB3]] ]
; CHECK-NEXT:    call void @llvm.assume(i1 true) [ "nonnull"(ptr [[I1]]) ]
; CHECK-NEXT:    [[I5]] = load ptr, ptr [[I1]], align 8
; CHECK-NEXT:    [[I2:%.*]] = icmp eq ptr [[I5]], null
; CHECK-NEXT:    br i1 [[I2]], label [[BB6:%.*]], label [[BB3]]
; CHECK:       bb6:
; CHECK-NEXT:    ret ptr undef
;
bb:
  br label %bb1

bb1:
  %i = phi ptr [ %i0, %bb ], [ %i5, %bb3 ]
  %i2 = icmp eq ptr %i, null
  br i1 %i2, label %bb6, label %bb3

bb3:
  call void @llvm.assume(i1 true) [ "nonnull"(ptr %i) ]
  %i5 = load ptr, ptr %i, align 8
  br label %bb1

bb6:
  ret ptr undef
}

declare void @llvm.assume(i1)