1; RUN: opt < %s -inline -S -enable-new-pm=0 | FileCheck %s
2; RUN: opt < %s -passes='cgscc(devirt<4>(inline))' -S | FileCheck %s
3; PR4834
4
5define i32 @test1() {
6  %funcall1_ = call fastcc i32 ()* () @f1()
7  %executecommandptr1_ = call i32 %funcall1_()
8  ret i32 %executecommandptr1_
9}
10
11define internal fastcc i32 ()* @f1() nounwind readnone {
12  ret i32 ()* @f2
13}
14
15define internal i32 @f2() nounwind readnone {
16  ret i32 1
17}
18
19; CHECK: @test1()
20; CHECK-NEXT: ret i32 1
21
22
23
24
25
26declare i8* @f1a(i8*) ssp align 2
27
28define internal i32 @f2a(i8* %t) inlinehint ssp {
29entry:
30  ret i32 41
31}
32
33define internal i32 @f3a(i32 (i8*)* %__f) ssp {
34entry:
35  %A = call i32 %__f(i8* undef)
36  ret i32 %A
37}
38
39define i32 @test2(i8* %this) ssp align 2 {
40  %X = call i32 @f3a(i32 (i8*)* @f2a) ssp
41  ret i32 %X
42}
43
44; CHECK-LABEL: @test2(
45; CHECK-NEXT: ret i32 41
46