1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/Transforms/Inline/frameescape.ll
Reid Kleckner 45072b933e Rename llvm.frameescape and llvm.framerecover to localescape and localrecover
Summary:
Initially, these intrinsics seemed like part of a family of "frame"
related intrinsics, but now I think that's more confusing than helpful.
Initially, the LangRef specified that this would create a new kind of
allocation that would be allocated at a fixed offset from the frame
pointer (EBP/RBP). We ended up dropping that design, and leaving the
stack frame layout alone.

These intrinsics are really about sharing local stack allocations, not
frame pointers. I intend to go further and add an `llvm.localaddress()`
intrinsic that returns whatever register (EBP, ESI, ESP, RBX) is being
used to address locals, which should not be confused with the frame
pointer.

Naming suggestions at this point are welcome, I'm happy to re-run sed.

Reviewers: majnemer, nicholas

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D11011

llvm-svn: 241633
2015-07-07 22:25:32 +00:00

45 lines
1.0 KiB
LLVM

; RUN: opt -inline -S < %s | FileCheck %s
; PR23216: We can't inline functions using llvm.localescape.
declare void @llvm.localescape(...)
declare i8* @llvm.frameaddress(i32)
declare i8* @llvm.localrecover(i8*, i8*, i32)
define internal void @foo(i8* %fp) {
%a.i8 = call i8* @llvm.localrecover(i8* bitcast (i32 ()* @bar to i8*), i8* %fp, i32 0)
%a = bitcast i8* %a.i8 to i32*
store i32 42, i32* %a
ret void
}
define internal i32 @bar() {
entry:
%a = alloca i32
call void (...) @llvm.localescape(i32* %a)
%fp = call i8* @llvm.frameaddress(i32 0)
tail call void @foo(i8* %fp)
%r = load i32, i32* %a
ret i32 %r
}
; We even bail when someone marks it alwaysinline.
define internal i32 @bar_alwaysinline() alwaysinline {
entry:
%a = alloca i32
call void (...) @llvm.localescape(i32* %a)
tail call void @foo(i8* null)
ret i32 0
}
define i32 @bazz() {
entry:
%r = tail call i32 @bar()
%r1 = tail call i32 @bar_alwaysinline()
ret i32 %r
}
; CHECK: define i32 @bazz()
; CHECK: call i32 @bar()
; CHECK: call i32 @bar_alwaysinline()