mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-24 03:25:00 +00:00
8f32e5f0d6
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241633 91177308-0d34-0410-b5e6-96231b3b80d8
45 lines
1.0 KiB
LLVM
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()
|