llvm-6502/test/Transforms/Inline/inline_returns_twice.ll
Joerg Sonnenberger 3470693641 Allow inlining of functions with returns_twice calls, if they have the
attribute themselve.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146851 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-18 20:35:43 +00:00

42 lines
804 B
LLVM

; 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: 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: 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
}