• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -inline -S < %s | FileCheck %s
2; RUN: opt -passes='cgscc(inline)' -S < %s | FileCheck %s
3
4define dso_local i32 @main() #0 {
5  %1 = alloca i32, align 4
6  store i32 0, i32* %1, align 4
7  %2 = call i32 @t32(i32 0)
8  ret i32 %2
9}
10
11define internal i32 @t32(i32) #0 {
12  %2 = alloca i32, align 4
13  %3 = alloca i32, align 4
14  store i32 %0, i32* %3, align 4
15  %4 = load i32, i32* %3, align 4
16  callbr void asm sideeffect "testl $0, $0; jne ${1:l};", "r,X,X,~{dirflag},~{fpsr},~{flags}"(i32 %4, i8* blockaddress(@t32, %7), i8* blockaddress(@t32, %6)) #1
17          to label %5 [label %7, label %6]
18
19; <label>:5:                                      ; preds = %1
20  store i32 0, i32* %2, align 4
21  br label %8
22
23; <label>:6:                                      ; preds = %1
24  store i32 1, i32* %2, align 4
25  br label %8
26
27; <label>:7:                                      ; preds = %1
28  store i32 2, i32* %2, align 4
29  br label %8
30
31; <label>:8:                                      ; preds = %7, %6, %5
32  %9 = load i32, i32* %2, align 4
33  ret i32 %9
34}
35
36; Check that @t32 no longer exists after inlining, as it has now been inlined
37; into @main.
38
39; CHECK-NOT: @t32
40; CHECK: define dso_local i32 @main
41; CHECK: callbr void asm sideeffect "testl $0, $0; jne ${1:l};", "r,X,X,~{dirflag},~{fpsr},~{flags}"(i32 %6, i8* blockaddress(@main, %9), i8* blockaddress(@main, %8))
42; CHECK: to label %7 [label %9, label %8]
43; CHECK: 7:
44; CHECK-NEXT: store i32 0, i32* %1, align 4
45; CHECK-NEXT: br label %t32.exit
46; CHECK: 8:
47; CHECK-NEXT: store i32 1, i32* %1, align 4
48; CHECK-NEXT: br label %t32.exit
49; CHECK: 9:
50; CHECK-NEXT: store i32 2, i32* %1, align 4
51; CHECK-NEXT: br label %t32.exit
52; CHECK: t32.exit:
53; CHECK-NEXT: %10 = load i32, i32* %1, align 4
54; CHECK: ret i32 %10
55