llvm/llvm/test/Transforms/SimplifyCFG/undef_phi.ll

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

declare void @foo()

; FIXME: We can replace %phi with true.
define void @test_01(i1 %cond) {
; CHECK-LABEL: @test_01(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[DOT:%.*]] = select i1 [[COND:%.*]], i1 true, i1 undef
; CHECK-NEXT:    br i1 [[DOT]], label [[RET_1:%.*]], label [[COMMON_RET:%.*]]
; CHECK:       common.ret:
; CHECK-NEXT:    ret void
; CHECK:       ret_1:
; CHECK-NEXT:    call void @foo()
; CHECK-NEXT:    br label [[COMMON_RET]]
;
entry:
  br i1 %cond, label %if.true, label %if.false

if.true:
  br label %merge

if.false:
  br label %merge

merge:
  %phi = phi i1 [true, %if.true], [undef, %if.false]
  br i1 %phi, label %ret_1, label %ret_2

ret_1:
  call void @foo()
  ret void

ret_2:
  ret void
}