xref: /llvm-project/llvm/test/tools/llvm-profgen/cs-preinline.test (revision 1662cfa4be33edd94ab71f8aa83676eb8b378f4a)
130b02323SWenlei He; Test default llvm-profgen with preinline off
2e36786d1SHongtao Yu; 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
3e36786d1SHongtao Yu; RUN: FileCheck %s --input-file %t1 --check-prefix=CHECK-DEFAULT
430b02323SWenlei He
530b02323SWenlei He; Test llvm-profgen with preinliner on will merge not inlinable profile into base profile.
6e36786d1SHongtao Yu; 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
7e36786d1SHongtao Yu; RUN: FileCheck %s --input-file %t2 --check-prefix=CHECK-PREINL
830b02323SWenlei He
930b02323SWenlei He; Test preinliner threshold that prevents all possible inlining and merges everything into base profile.
10e36786d1SHongtao Yu; 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
11e36786d1SHongtao Yu; RUN: FileCheck %s --input-file %t3 --check-prefix=CHECK-NO-PREINL
1230b02323SWenlei He
13259e4c56SHongtao Yu; Test cold profile trimming. Only base profiles should be dropped.
14e36786d1SHongtao Yu; 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
15259e4c56SHongtao Yu
16e36786d1SHongtao Yu; RUN: FileCheck %s --input-file %t4 --check-prefix=CHECK-TRIM
17259e4c56SHongtao Yu
185740bb80SHongtao Yu; Test llvm-profgen with preinliner on will merge not inlinable profile into base profile.
19e36786d1SHongtao Yu; 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
20e36786d1SHongtao Yu; RUN: FileCheck %s --input-file %t5 --check-prefix=CHECK-PREINL-NEST
21e36786d1SHongtao Yu
22e36786d1SHongtao Yu; Test preInlined flat is set for extbinary profiles with preinliner on.
23e36786d1SHongtao Yu; 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
24e36786d1SHongtao Yu; RUN: llvm-profdata show --sample -show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG
25e36786d1SHongtao Yu; 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
26e36786d1SHongtao Yu; RUN: llvm-profdata show --sample -show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG
27e36786d1SHongtao Yu
28e36786d1SHongtao Yu; Test preInlined flat is set when converted from a text profile that has "ShouldInline" contexts.
29e36786d1SHongtao Yu; RUN: llvm-profdata merge --sample %t2 -o %t2.prof --extbinary
30e36786d1SHongtao Yu; RUN: llvm-profdata show --sample -show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG
31e36786d1SHongtao Yu; RUN: llvm-profdata merge --sample %t5 -o %t5.prof --extbinary
32e36786d1SHongtao Yu; RUN: llvm-profdata show --sample -show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG
33e36786d1SHongtao Yu
345740bb80SHongtao Yu
35484a569eSwlei; CHECK-DEFAULT:     [main:1 @ foo]:309:0
3630b02323SWenlei He; CHECK-DEFAULT-NEXT: 2.1: 14
3730b02323SWenlei He; CHECK-DEFAULT-NEXT: 3: 15
3830b02323SWenlei He; CHECK-DEFAULT-NEXT: 3.1: 14 bar:14
3930b02323SWenlei He; CHECK-DEFAULT-NEXT: 3.2: 1
40484a569eSwlei; CHECK-DEFAULT-NEXT: 65526: 14
4130b02323SWenlei He; CHECK-DEFAULT-NEXT: !Attributes: 1
42484a569eSwlei; CHECK-DEFAULT-NEXT:[main:1 @ foo:3.1 @ bar]:84:0
4330b02323SWenlei He; CHECK-DEFAULT-NEXT: 1: 14
4430b02323SWenlei He; CHECK-DEFAULT-NEXT: !Attributes: 1
4530b02323SWenlei He
46484a569eSwlei; CHECK-PREINL:     [foo]:309:0
4730b02323SWenlei He; CHECK-PREINL-NEXT: 2.1: 14
4830b02323SWenlei He; CHECK-PREINL-NEXT: 3: 15
4930b02323SWenlei He; CHECK-PREINL-NEXT: 3.1: 14 bar:14
5030b02323SWenlei He; CHECK-PREINL-NEXT: 3.2: 1
51484a569eSwlei; CHECK-PREINL-NEXT: 65526: 14
5230b02323SWenlei He; CHECK-PREINL-NEXT: !Attributes: 1
53484a569eSwlei; CHECK-PREINL-NEXT:[foo:3.1 @ bar]:84:0
5430b02323SWenlei He; CHECK-PREINL-NEXT: 1: 14
5530b02323SWenlei He; CHECK-PREINL-NEXT: !Attributes: 3
5630b02323SWenlei He
57484a569eSwlei; CHECK-NO-PREINL:     [foo]:309:0
5830b02323SWenlei He; CHECK-NO-PREINL-NEXT: 2.1: 14
5930b02323SWenlei He; CHECK-NO-PREINL-NEXT: 3: 15
6030b02323SWenlei He; CHECK-NO-PREINL-NEXT: 3.1: 14 bar:14
6130b02323SWenlei He; CHECK-NO-PREINL-NEXT: 3.2: 1
62484a569eSwlei; CHECK-NO-PREINL-NEXT: 65526: 14
6330b02323SWenlei He; CHECK-NO-PREINL-NEXT: !Attributes: 1
64484a569eSwlei; CHECK-NO-PREINL-NEXT:[bar]:84:0
6530b02323SWenlei He; CHECK-NO-PREINL-NEXT: 1: 14
6630b02323SWenlei He; CHECK-NO-PREINL-NEXT: !Attributes: 1
67259e4c56SHongtao Yu
68484a569eSwlei; CHECK-TRIM-NOT: [foo]:309:0
69484a569eSwlei; CHECK-TRIM:[foo:3.1 @ bar]:84:0
70259e4c56SHongtao Yu; CHECK-TRIM-NEXT: 1: 14
71259e4c56SHongtao Yu; CHECK-TRIM-NEXT: !Attributes: 3
725740bb80SHongtao Yu
73*1662cfa4SHongtao Yu; CHECK-PREINL-NEST:     foo:379:0
745740bb80SHongtao Yu; CHECK-PREINL-NEST-NEXT: 2.1: 14
755740bb80SHongtao Yu; CHECK-PREINL-NEST-NEXT: 3: 15
765740bb80SHongtao Yu; CHECK-PREINL-NEST-NEXT: 3.2: 1
775740bb80SHongtao Yu; CHECK-PREINL-NEST-NEXT: 65526: 14
785740bb80SHongtao Yu; CHECK-PREINL-NEST-NEXT: 3.1: bar:84
795740bb80SHongtao Yu; CHECK-PREINL-NEST-NEXT:  1: 14
8023191a4fSHongtao Yu; CHECK-PREINL-NEST-NEXT:  !Attributes: 3
81e36786d1SHongtao Yu
82e36786d1SHongtao Yu
83e36786d1SHongtao Yu; CHECK-PREINL-FLAG: ProfileSummarySection {{.*}} Flags: {{{.*}}preInlined}
84