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
; RUN: opt < %s -inline -S | FileCheck %s
; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s

; Check that functions with "returns_twice" calls are only inlined,
; if they are themselves marked as such.

declare i32 @a() returns_twice

define i32 @inner1() {
entry:
  %call = call i32 @a() returns_twice
  %add = add nsw i32 1, %call
  ret i32 %add
}

define i32 @outer1() {
entry:
; CHECK-LABEL: define i32 @outer1(
; CHECK: call i32 @inner1()
  %call = call i32 @inner1()
  %add = add nsw i32 1, %call
  ret i32 %add
}

define i32 @inner2() returns_twice {
entry:
  %call = call i32 @a() returns_twice
  %add = add nsw i32 1, %call
  ret i32 %add
}

define i32 @outer2() {
entry:
; CHECK-LABEL: define i32 @outer2(
; CHECK: call i32 @a()
  %call = call i32 @inner2() returns_twice
  %add = add nsw i32 1, %call
  ret i32 %add
}

define i32 @inner3() personality i8* null {
entry:
  %invoke = invoke i32 @a() returns_twice
      to label %cont unwind label %lpad

cont:
  %add = add nsw i32 1, %invoke
  ret i32 %add

lpad:
  %lp = landingpad i32 cleanup
  resume i32 %lp
}

define i32 @outer3() {
entry:
; CHECK-LABEL: define i32 @outer3(
; CHECK: call i32 @inner3()
  %call = call i32 @inner3()
  %add = add nsw i32 1, %call
  ret i32 %add
}

define i32 @inner4() returns_twice personality i8* null {
entry:
  %invoke = invoke i32 @a() returns_twice
      to label %cont unwind label %lpad

cont:
  %add = add nsw i32 1, %invoke
  ret i32 %add

lpad:
  %lp = landingpad i32 cleanup
  resume i32 %lp
}

define i32 @outer4() {
entry:
; CHECK-LABEL: define i32 @outer4(
; CHECK: invoke i32 @a()
  %call = call i32 @inner4() returns_twice
  %add = add nsw i32 1, %call
  ret i32 %add
}