xref: /llvm-project/llvm/test/tools/llvm-profgen/cs-preinline.test (revision 1662cfa4be33edd94ab71f8aa83676eb8b378f4a)
1; Test default llvm-profgen with preinline off
2; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=0 --gen-cs-nested-profile=0 --output=%t1
3; RUN: FileCheck %s --input-file %t1 --check-prefix=CHECK-DEFAULT
4
5; Test llvm-profgen with preinliner on will merge not inlinable profile into base profile.
6; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --gen-cs-nested-profile=0 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t2
7; RUN: FileCheck %s --input-file %t2 --check-prefix=CHECK-PREINL
8
9; Test preinliner threshold that prevents all possible inlining and merges everything into base profile.
10; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --gen-cs-nested-profile=0 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=0 --output=%t3
11; RUN: FileCheck %s --input-file %t3 --check-prefix=CHECK-NO-PREINL
12
13; Test cold profile trimming. Only base profiles should be dropped.
14; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --gen-cs-nested-profile=0 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t4 --trim-cold-profile=1 --profile-summary-hot-count=400
15
16; RUN: FileCheck %s --input-file %t4 --check-prefix=CHECK-TRIM
17
18; Test llvm-profgen with preinliner on will merge not inlinable profile into base profile.
19; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin  --csspgo-preinliner=1 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t5 --gen-cs-nested-profile=1
20; RUN: FileCheck %s --input-file %t5 --check-prefix=CHECK-PREINL-NEST
21
22; Test preInlined flat is set for extbinary profiles with preinliner on.
23; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --gen-cs-nested-profile=0 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t2.prof
24; RUN: llvm-profdata show --sample -show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG
25; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin  --csspgo-preinliner=1 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t5.prof --gen-cs-nested-profile=1
26; RUN: llvm-profdata show --sample -show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG
27
28; Test preInlined flat is set when converted from a text profile that has "ShouldInline" contexts.
29; RUN: llvm-profdata merge --sample %t2 -o %t2.prof --extbinary
30; RUN: llvm-profdata show --sample -show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG
31; RUN: llvm-profdata merge --sample %t5 -o %t5.prof --extbinary
32; RUN: llvm-profdata show --sample -show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG
33
34
35; CHECK-DEFAULT:     [main:1 @ foo]:309:0
36; CHECK-DEFAULT-NEXT: 2.1: 14
37; CHECK-DEFAULT-NEXT: 3: 15
38; CHECK-DEFAULT-NEXT: 3.1: 14 bar:14
39; CHECK-DEFAULT-NEXT: 3.2: 1
40; CHECK-DEFAULT-NEXT: 65526: 14
41; CHECK-DEFAULT-NEXT: !Attributes: 1
42; CHECK-DEFAULT-NEXT:[main:1 @ foo:3.1 @ bar]:84:0
43; CHECK-DEFAULT-NEXT: 1: 14
44; CHECK-DEFAULT-NEXT: !Attributes: 1
45
46; CHECK-PREINL:     [foo]:309:0
47; CHECK-PREINL-NEXT: 2.1: 14
48; CHECK-PREINL-NEXT: 3: 15
49; CHECK-PREINL-NEXT: 3.1: 14 bar:14
50; CHECK-PREINL-NEXT: 3.2: 1
51; CHECK-PREINL-NEXT: 65526: 14
52; CHECK-PREINL-NEXT: !Attributes: 1
53; CHECK-PREINL-NEXT:[foo:3.1 @ bar]:84:0
54; CHECK-PREINL-NEXT: 1: 14
55; CHECK-PREINL-NEXT: !Attributes: 3
56
57; CHECK-NO-PREINL:     [foo]:309:0
58; CHECK-NO-PREINL-NEXT: 2.1: 14
59; CHECK-NO-PREINL-NEXT: 3: 15
60; CHECK-NO-PREINL-NEXT: 3.1: 14 bar:14
61; CHECK-NO-PREINL-NEXT: 3.2: 1
62; CHECK-NO-PREINL-NEXT: 65526: 14
63; CHECK-NO-PREINL-NEXT: !Attributes: 1
64; CHECK-NO-PREINL-NEXT:[bar]:84:0
65; CHECK-NO-PREINL-NEXT: 1: 14
66; CHECK-NO-PREINL-NEXT: !Attributes: 1
67
68; CHECK-TRIM-NOT: [foo]:309:0
69; CHECK-TRIM:[foo:3.1 @ bar]:84:0
70; CHECK-TRIM-NEXT: 1: 14
71; CHECK-TRIM-NEXT: !Attributes: 3
72
73; CHECK-PREINL-NEST:     foo:379:0
74; CHECK-PREINL-NEST-NEXT: 2.1: 14
75; CHECK-PREINL-NEST-NEXT: 3: 15
76; CHECK-PREINL-NEST-NEXT: 3.2: 1
77; CHECK-PREINL-NEST-NEXT: 65526: 14
78; CHECK-PREINL-NEST-NEXT: 3.1: bar:84
79; CHECK-PREINL-NEST-NEXT:  1: 14
80; CHECK-PREINL-NEST-NEXT:  !Attributes: 3
81
82
83; CHECK-PREINL-FLAG: ProfileSummarySection {{.*}} Flags: {{{.*}}preInlined}
84