; RUN: opt < %s -inline -S | FileCheck %s

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

declare i32 @a() returns_twice
declare i32 @b() returns_twice

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

define i32 @g() {
entry:
; CHECK-LABEL: define i32 @g(
; CHECK: call i32 @f()
; CHECK-NOT: call i32 @a()
  %call = call i32 @f()
  %add = add nsw i32 1, %call
  ret i32 %add
}

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

define i32 @i() {
entry:
; CHECK-LABEL: define i32 @i(
; CHECK: call i32 @b()
; CHECK-NOT: call i32 @h()
  %call = call i32 @h() returns_twice
  %add = add nsw i32 1, %call
  ret i32 %add
}

; RUN: opt < %s -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
declare i32 @b() returns_twice

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

define i32 @g() {
entry:
; CHECK-LABEL: define i32 @g(
; CHECK: call i32 @f()
; CHECK-NOT: call i32 @a()
  %call = call i32 @f()
  %add = add nsw i32 1, %call
  ret i32 %add
}

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

define i32 @i() {
entry:
; CHECK-LABEL: define i32 @i(
; CHECK: call i32 @b()
; CHECK-NOT: call i32 @h()
  %call = call i32 @h() returns_twice
  %add = add nsw i32 1, %call
  ret i32 %add
}

Fix spelling in comment in test: "themselve" -> "themselves"
Fix spelling in comment in test: "themselve" -> "themselves"

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@197180 91177308-0d34-0410-b5e6-96231b3b80d8
