1 ; RUN: opt -inline -S < %s | FileCheck %s
2 ; RUN: opt -passes='cgscc(inline)' -S < %s | FileCheck %s
4 ; PR23216: We can't inline functions using llvm.localescape.
6 declare void @llvm.localescape(...)
7 declare i8* @llvm.frameaddress(i32)
8 declare i8* @llvm.localrecover(i8*, i8*, i32)
10 define internal void @foo(i8* %fp) {
11 %a.i8 = call i8* @llvm.localrecover(i8* bitcast (i32 ()* @bar to i8*), i8* %fp, i32 0)
12 %a = bitcast i8* %a.i8 to i32*
17 define internal i32 @bar() {
20 call void (...) @llvm.localescape(i32* %a)
21 %fp = call i8* @llvm.frameaddress(i32 0)
22 tail call void @foo(i8* %fp)
23 %r = load i32, i32* %a
27 ; We even bail when someone marks it alwaysinline.
28 define internal i32 @bar_alwaysinline() alwaysinline {
31 call void (...) @llvm.localescape(i32* %a)
32 tail call void @foo(i8* null)
38 %r = tail call i32 @bar()
39 %r1 = tail call i32 @bar_alwaysinline()
43 ; CHECK: define i32 @bazz()
44 ; CHECK: call i32 @bar()
45 ; CHECK: call i32 @bar_alwaysinline()