llvm/llvm/test/Transforms/Reg2Mem/callbr-crash.ll

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

define void @crash() {
; CHECK-LABEL: @crash(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[A_REG2MEM:%.*]] = alloca i64, align 8
; CHECK-NEXT:    %"reg2mem alloca point" = bitcast i32 0 to i32
; CHECK-NEXT:    [[A:%.*]] = callbr i64 asm "", "=r,r,!i"(i64 0)
; CHECK-NEXT:            to label [[THEN:%.*]] [label %entry.else_crit_edge]
; CHECK:       entry.else_crit_edge:
; CHECK-NEXT:    store i64 [[A]], ptr [[A_REG2MEM]], align 4
; CHECK-NEXT:    br label [[ELSE:%.*]]
; CHECK:       then:
; CHECK-NEXT:    store i64 [[A]], ptr [[A_REG2MEM]], align 4
; CHECK-NEXT:    [[A_RELOAD:%.*]] = load i64, ptr [[A_REG2MEM]], align 4
; CHECK-NEXT:    [[B:%.*]] = inttoptr i64 [[A_RELOAD]] to ptr
; CHECK-NEXT:    br label [[ELSE]]
; CHECK:       else:
; CHECK-NEXT:    ret void
;
entry:
  %a = callbr i64 asm "", "=r,r,!i"(i64 0)
  to label %then [label %else]

then:
  %b = inttoptr i64 %a to ptr
  br label %else

else:
  ret void
}