; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -enable-machine-outliner -mtriple=x86_64-unknown-linux < %s | FileCheck %s
@x = dso_local global i32 0, align 4
define dso_local i32 @check_boundaries() #0 {
; CHECK-LABEL: check_boundaries:
; CHECK: # %bb.0:
; CHECK-NEXT: pushq %rbp
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset %rbp, -16
; CHECK-NEXT: movq %rsp, %rbp
; CHECK-NEXT: .cfi_def_cfa_register %rbp
; CHECK-NEXT: subq $20, %rsp
; CHECK-NEXT: movl $0, -20(%rbp)
; CHECK-NEXT: movl $0, -8(%rbp)
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: testb %al, %al
; CHECK-NEXT: je .LBB0_1
; CHECK-NEXT: # %bb.2:
; CHECK-NEXT: movl $1, -4(%rbp)
; CHECK-NEXT: cmpl $0, -8(%rbp)
; CHECK-NEXT: je .LBB0_4
; CHECK-NEXT: .LBB0_5:
; CHECK-NEXT: movl $1, -4(%rbp)
; CHECK-NEXT: jmp .LBB0_6
; CHECK-NEXT: .LBB0_1:
; CHECK-NEXT: callq OUTLINED_FUNCTION_0
; CHECK-NEXT: cmpl $0, -8(%rbp)
; CHECK-NEXT: jne .LBB0_5
; CHECK-NEXT: .LBB0_4:
; CHECK-NEXT: callq OUTLINED_FUNCTION_0
; CHECK-NEXT: .LBB0_6:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: addq $20, %rsp
; CHECK-NEXT: popq %rbp
; CHECK-NEXT: .cfi_def_cfa %rsp, 8
; CHECK-NEXT: retq
%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: # %bb.0:
; CHECK-NEXT: pushq %rbp
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset %rbp, -16
; CHECK-NEXT: movq %rsp, %rbp
; CHECK-NEXT: .cfi_def_cfa_register %rbp
; CHECK-NEXT: subq $20, %rsp
; CHECK-NEXT: movl $0, -20(%rbp)
; CHECK-NEXT: callq OUTLINED_FUNCTION_1
; CHECK-NEXT: movl $1, x(%rip)
; CHECK-NEXT: #APP
; CHECK-NEXT: #NO_APP
; CHECK-NEXT: callq OUTLINED_FUNCTION_1
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: addq $20, %rsp
; CHECK-NEXT: popq %rbp
; CHECK-NEXT: .cfi_def_cfa %rsp, 8
; CHECK-NEXT: retq
%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" }