1 ; RUN: opt -inline -S < %s | FileCheck %s 2 ; RUN: opt -passes='cgscc(inline)' -S < %s | FileCheck %s 3 4 ; PR23216: We can't inline functions using llvm.localescape. 5 6 declare void @llvm.localescape(...) 7 declare i8* @llvm.frameaddress(i32) 8 declare i8* @llvm.localrecover(i8*, i8*, i32) 9 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* 13 store i32 42, i32* %a 14 ret void 15 } 16 17 define internal i32 @bar() { 18 entry: 19 %a = alloca i32 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 24 ret i32 %r 25 } 26 27 ; We even bail when someone marks it alwaysinline. 28 define internal i32 @bar_alwaysinline() alwaysinline { 29 entry: 30 %a = alloca i32 31 call void (...) @llvm.localescape(i32* %a) 32 tail call void @foo(i8* null) 33 ret i32 0 34 } 35 36 define i32 @bazz() { 37 entry: 38 %r = tail call i32 @bar() 39 %r1 = tail call i32 @bar_alwaysinline() 40 ret i32 %r 41 } 42 43 ; CHECK: define i32 @bazz() 44 ; CHECK: call i32 @bar() 45 ; CHECK: call i32 @bar_alwaysinline() 46