Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -enable-machine-outliner -mtriple=sparc-unknown-linux < %s | FileCheck %s

; NOTE: Machine outliner doesn't run.
@x = global i32 0, align 4

define dso_local i32 @check_boundaries() #0 {
; CHECK-LABEL: check_boundaries:
; CHECK:         .cfi_startproc
; CHECK-NEXT:  ! %bb.0:
; CHECK-NEXT:    save %sp, -112, %sp
; CHECK-NEXT:    .cfi_def_cfa_register %fp
; CHECK-NEXT:    .cfi_window_save
; CHECK-NEXT:    .cfi_register %o7, %i7
; CHECK-NEXT:    st %g0, [%fp+-4]
; CHECK-NEXT:    mov %g0, %i0
; CHECK-NEXT:    cmp %i0, 0
; CHECK-NEXT:    st %g0, [%fp+-8]
; CHECK-NEXT:    be .LBB0_1
; CHECK-NEXT:    mov 1, %i0
; CHECK-NEXT:  ! %bb.2:
; CHECK-NEXT:    ba .LBB0_3
; CHECK-NEXT:    st %i0, [%fp+-16]
; CHECK-NEXT:  .LBB0_1:
; CHECK-NEXT:    st %i0, [%fp+-8]
; CHECK-NEXT:    mov 2, %i0
; CHECK-NEXT:    st %i0, [%fp+-12]
; CHECK-NEXT:    mov 3, %i0
; CHECK-NEXT:    st %i0, [%fp+-16]
; CHECK-NEXT:    mov 4, %i0
; CHECK-NEXT:    st %i0, [%fp+-20]
; CHECK-NEXT:  .LBB0_3:
; CHECK-NEXT:    ld [%fp+-8], %i0
; CHECK-NEXT:    cmp %i0, 0
; CHECK-NEXT:    be .LBB0_4
; CHECK-NEXT:    nop
; CHECK-NEXT:  ! %bb.5:
; CHECK-NEXT:    mov 1, %i0
; CHECK-NEXT:    ba .LBB0_6
; CHECK-NEXT:    st %i0, [%fp+-16]
; CHECK-NEXT:  .LBB0_4:
; CHECK-NEXT:    mov 1, %i0
; CHECK-NEXT:    st %i0, [%fp+-8]
; CHECK-NEXT:    mov 2, %i0
; CHECK-NEXT:    st %i0, [%fp+-12]
; CHECK-NEXT:    mov 3, %i0
; CHECK-NEXT:    st %i0, [%fp+-16]
; CHECK-NEXT:    mov 4, %i0
; CHECK-NEXT:    st %i0, [%fp+-20]
; CHECK-NEXT:  .LBB0_6:
; CHECK-NEXT:    ret
; CHECK-NEXT:    restore %g0, %g0, %o0
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 0, i32* %1, align 4
  store i32 0, i32* %2, align 4
  %6 = load i32, i32* %2, align 4
  %7 = icmp ne i32 %6, 0
  br i1 %7, label %9, label %8

  store i32 1, i32* %2, align 4
  store i32 2, i32* %3, align 4
  store i32 3, i32* %4, align 4
  store i32 4, i32* %5, align 4
  br label %10

  store i32 1, i32* %4, align 4
  br label %10

  %11 = load i32, i32* %2, align 4
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %14, label %13

  store i32 1, i32* %2, align 4
  store i32 2, i32* %3, align 4
  store i32 3, i32* %4, align 4
  store i32 4, i32* %5, align 4
  br label %15

  store i32 1, i32* %4, align 4
  br label %15

  ret i32 0
}

define dso_local i32 @main() #0 {
; CHECK-LABEL: main:
; CHECK:         .cfi_startproc
; CHECK-NEXT:  ! %bb.0:
; CHECK-NEXT:    save %sp, -112, %sp
; CHECK-NEXT:    .cfi_def_cfa_register %fp
; CHECK-NEXT:    .cfi_window_save
; CHECK-NEXT:    .cfi_register %o7, %i7
; CHECK-NEXT:    st %g0, [%fp+-4]
; CHECK-NEXT:    sethi %hi(x), %i0
; CHECK-NEXT:    mov 1, %i1
; CHECK-NEXT:    st %i1, [%fp+-8]
; CHECK-NEXT:    mov 2, %i2
; CHECK-NEXT:    st %i2, [%fp+-12]
; CHECK-NEXT:    mov 3, %i3
; CHECK-NEXT:    st %i3, [%fp+-16]
; CHECK-NEXT:    mov 4, %i4
; CHECK-NEXT:    st %i4, [%fp+-20]
; CHECK-NEXT:    st %i1, [%i0+%lo(x)]
; CHECK-NEXT:    !APP
; CHECK-NEXT:    !NO_APP
; CHECK-NEXT:    st %i1, [%fp+-8]
; CHECK-NEXT:    st %i2, [%fp+-12]
; CHECK-NEXT:    st %i3, [%fp+-16]
; CHECK-NEXT:    mov %g0, %i0
; CHECK-NEXT:    st %i4, [%fp+-20]
; CHECK-NEXT:    ret
; CHECK-NEXT:    restore
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4

  store i32 0, i32* %1, align 4
  store i32 0, i32* @x, align 4
  store i32 1, i32* %2, align 4
  store i32 2, i32* %3, align 4
  store i32 3, i32* %4, align 4
  store i32 4, i32* %5, align 4
  store i32 1, i32* @x, align 4
  call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
  store i32 1, i32* %2, align 4
  store i32 2, i32* %3, align 4
  store i32 3, i32* %4, align 4
  store i32 4, i32* %5, align 4
  ret i32 0
}

attributes #0 = { noredzone nounwind ssp uwtable "frame-pointer"="all" }