reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
; RUN: llc -enable-machine-outliner -mtriple=x86_64-apple-darwin < %s | FileCheck %s

@x = global i32 0, align 4

define i32 @check_boundaries() #0 {
  ; CHECK-LABEL: _check_boundaries:
  %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

  ; CHECK: callq 
  ; CHECK-SAME: [[OFUNC1:OUTLINED_FUNCTION_[0-9]+]]
  ; CHECK: cmpl  $0, -{{[0-9]+}}(%rbp)
  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

  ; CHECK: callq
  ; CHECK-SAME: [[OFUNC1]]
  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 i32 @empty_1() #0 {
  ; CHECK-LABEL: _empty_1:
  ; CHECK-NOT: OUTLINED_FUNCTION
  ret i32 1
}

define i32 @empty_2() #0 {
  ; CHECK-LABEL: _empty_2
  ; CHECK-NOT: OUTLINED_FUNCTION
  ret i32 1
}

define i32 @no_empty_outlining() #0 {
  ; CHECK-LABEL: _no_empty_outlining:
  %1 = alloca i32, align 4
  store i32 0, i32* %1, align 4
  ; CHECK-NOT: OUTLINED_FUNCTION
  %2 = call i32 @empty_1() #1
  %3 = call i32 @empty_2() #1
  %4 = call i32 @empty_1() #1
  %5 = call i32 @empty_2() #1
  %6 = call i32 @empty_1() #1
  %7 = call i32 @empty_2() #1
  ret i32 0
}

define i32 @main() #0 {
  ; CHECK-LABEL: _main:
  %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
  ; CHECK: callq
  ; CHECK-SAME: [[OFUNC2:OUTLINED_FUNCTION_[0-9]+]]
  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}"()
  ; CHECK: callq
  ; CHECK-SAME: [[OFUNC2]]
  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 "no-frame-pointer-elim"="true" }

; CHECK: OUTLINED_FUNCTION_{{[0-9]+}}:
; CHECK-DAG:      movl  $1, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl  $2, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl  $3, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl  $4, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: retq

; CHECK: OUTLINED_FUNCTION_{{[0-9]+}}:
; CHECK-DAG:      movl  $1, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl  $2, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl  $3, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl  $4, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: retq