llvm-project/llvm/test/Transforms/LoopRotate/phi-empty.ll

40 lines
1.0 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -lcssa -loop-rotate < %s | FileCheck %s
; After rotate, the phi has no operands because it has no predecessors.
; We might want to delete that instruction instead, but we do not
; fail/assert by assuming that the phi is invalid IR.
define void @PR48296(i1 %cond) {
; CHECK-LABEL: @PR48296(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: br i1 [[COND:%.*]], label [[INC:%.*]], label [[LOOP_BACKEDGE:%.*]]
; CHECK: loop.backedge:
; CHECK-NEXT: br label [[LOOP]]
; CHECK: dead:
; CHECK-NEXT: unreachable
; CHECK: inc:
; CHECK-NEXT: br label [[LOOP_BACKEDGE]]
; CHECK: return:
; CHECK-NEXT: [[R:%.*]] = phi i32
; CHECK-NEXT: ret void
;
entry:
br label %loop
loop:
br i1 %cond, label %inc, label %loop
dead: ; No predecessors!
br i1 %cond, label %inc, label %return
inc:
br label %loop
return:
%r = phi i32 [ undef, %dead ]
ret void
}