• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -inline -S < %s | FileCheck %s
2
3; PR23216: We can't inline functions using llvm.localescape.
4
5declare void @llvm.localescape(...)
6declare i8* @llvm.frameaddress(i32)
7declare i8* @llvm.localrecover(i8*, i8*, i32)
8
9define internal void @foo(i8* %fp) {
10  %a.i8 = call i8* @llvm.localrecover(i8* bitcast (i32 ()* @bar to i8*), i8* %fp, i32 0)
11  %a = bitcast i8* %a.i8 to i32*
12  store i32 42, i32* %a
13  ret void
14}
15
16define internal i32 @bar() {
17entry:
18  %a = alloca i32
19  call void (...) @llvm.localescape(i32* %a)
20  %fp = call i8* @llvm.frameaddress(i32 0)
21  tail call void @foo(i8* %fp)
22  %r = load i32, i32* %a
23  ret i32 %r
24}
25
26; We even bail when someone marks it alwaysinline.
27define internal i32 @bar_alwaysinline() alwaysinline {
28entry:
29  %a = alloca i32
30  call void (...) @llvm.localescape(i32* %a)
31  tail call void @foo(i8* null)
32  ret i32 0
33}
34
35define i32 @bazz() {
36entry:
37  %r = tail call i32 @bar()
38  %r1 = tail call i32 @bar_alwaysinline()
39  ret i32 %r
40}
41
42; CHECK: define i32 @bazz()
43; CHECK: call i32 @bar()
44; CHECK: call i32 @bar_alwaysinline()
45