; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=lcssa -S -verify-loop-info | FileCheck %s
; LCSSA doesn't need to transform uses in blocks not reachable
; from the entry block.
; PR6546
define void @test_pr6546(ptr %src, i1 %c) {
; CHECK-LABEL: @test_pr6546(
; CHECK-NEXT: bb:
; CHECK-NEXT: br label [[BB44:%.*]]
; CHECK: bb44:
; CHECK-NEXT: br i1 [[C:%.*]], label [[BB7:%.*]], label [[BB45:%.*]]
; CHECK: bb7:
; CHECK-NEXT: [[TMP:%.*]] = getelementptr ptr, ptr [[SRC:%.*]], i64 3
; CHECK-NEXT: br label [[BB15:%.*]]
; CHECK: bb15:
; CHECK-NEXT: br label [[BB44]]
; CHECK: bb32:
; CHECK-NEXT: [[TMP33:%.*]] = load ptr, ptr [[TMP]], align 8
; CHECK-NEXT: br label [[BB45]]
; CHECK: bb45:
; CHECK-NEXT: unreachable
;
bb:
br label %bb44
bb44:
br i1 %c, label %bb7, label %bb45
bb7:
%tmp = getelementptr ptr, ptr %src, i64 3
br label %bb15
bb15:
br label %bb44
bb32:
%tmp33 = load ptr, ptr %tmp, align 8
br label %bb45
bb45:
unreachable
}
define void @multiple_unreachable_uses(ptr %A, ptr %B) {
entry:
br label %loop
loop:
%gep.A = getelementptr inbounds float, ptr %A, i64 10
%gep.B = getelementptr inbounds ptr, ptr %B, i64 20
br i1 false, label %exit, label %loop
dead: ; No predecessors!
%l1 = load float, ptr %gep.A, align 4
%l2 = load ptr, ptr %gep.B, align 8
br label %exit
exit:
ret void
}