Skip to content

Commit 93dc1b5

Browse files
committed
[Remarks][2/2] Expand remarks hotness threshold option support in more tools
This is the #2 of 2 changes that make remarks hotness threshold option available in more tools. The changes also allow the threshold to sync with hotness threshold from profile summary with special value 'auto'. This change expands remarks hotness threshold option -fdiagnostics-hotness-threshold in clang and *-remarks-hotness-threshold in other tools to utilize hotness threshold from profile summary. Remarks hotness filtering relies on several driver options. Table below lists how different options are correlated and affect final remarks outputs: | profile | hotness | threshold | remarks printed | |---------|---------|-----------|-----------------| | No | No | No | All | | No | No | Yes | None | | No | Yes | No | All | | No | Yes | Yes | None | | Yes | No | No | All | | Yes | No | Yes | None | | Yes | Yes | No | All | | Yes | Yes | Yes | >=threshold | In the presence of profile summary, it is often more desirable to directly use the hotness threshold from profile summary. The new argument value 'auto' indicates threshold will be synced with hotness threshold from profile summary during compilation. The "auto" threshold relies on the availability of profile summary. In case of missing such information, no remarks will be generated. Differential Revision: https://reviews.llvm.org/D85808
1 parent 3acda91 commit 93dc1b5

File tree

18 files changed

+313
-23
lines changed

18 files changed

+313
-23
lines changed

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,6 @@ VALUE_CODEGENOPT(EmitCheckPathComponentsToStrip, 32, 0)
366366
/// Whether to report the hotness of the code region for optimization remarks.
367367
CODEGENOPT(DiagnosticsWithHotness, 1, 0)
368368

369-
/// The minimum hotness value a diagnostic needs in order to be included in
370-
/// optimization diagnostics.
371-
VALUE_CODEGENOPT(DiagnosticsHotnessThreshold, 32, 0)
372-
373369
/// Whether copy relocations support is available when building as PIE.
374370
CODEGENOPT(PIECopyRelocations, 1, 0)
375371

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,21 @@ class CodeGenOptions : public CodeGenOptionsBase {
346346
const char *Argv0 = nullptr;
347347
ArrayRef<const char *> CommandLineArgs;
348348

349+
/// The minimum hotness value a diagnostic needs in order to be included in
350+
/// optimization diagnostics.
351+
///
352+
/// The threshold is an Optional value, which maps to one of the 3 states:
353+
/// 1. 0 => threshold disabled. All remarks will be printed.
354+
/// 2. positive int => manual threshold by user. Remarks with hotness exceed
355+
/// threshold will be printed.
356+
/// 3. None => 'auto' threshold by user. The actual value is not
357+
/// available at command line, but will be synced with
358+
/// hotness threshold from profile summary during
359+
/// compilation.
360+
///
361+
/// If threshold option is not specified, it is disabled by default.
362+
Optional<uint64_t> DiagnosticsHotnessThreshold = 0;
363+
349364
public:
350365
// Define accessors/mutators for code generation options of enumeration type.
351366
#define CODEGENOPT(Name, Bits, Default)

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ def err_drv_command_failure : Error<
117117
"unable to execute command: %0">;
118118
def err_drv_invalid_darwin_version : Error<
119119
"invalid Darwin version number: %0">;
120+
def err_drv_invalid_diagnotics_hotness_threshold : Error<
121+
"invalid argument in '%0', only integer or 'auto' is supported">;
120122
def err_drv_missing_argument : Error<
121123
"argument to '%0' is missing (expected %1 value%s1)">;
122124
def err_drv_invalid_Xarch_argument_with_args : Error<

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,8 +984,9 @@ def fdiagnostics_print_source_range_info : Flag<["-"], "fdiagnostics-print-sourc
984984
def fdiagnostics_show_hotness : Flag<["-"], "fdiagnostics-show-hotness">, Group<f_Group>,
985985
Flags<[CC1Option]>, HelpText<"Enable profile hotness information in diagnostic line">;
986986
def fdiagnostics_hotness_threshold_EQ : Joined<["-"], "fdiagnostics-hotness-threshold=">,
987-
Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<number>">,
988-
HelpText<"Prevent optimization remarks from being output if they do not have at least this profile count">;
987+
Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<value>">,
988+
HelpText<"Prevent optimization remarks from being output if they do not have at least this profile count. "
989+
"Use 'auto' to apply the threshold from profile summary">;
989990
def fdiagnostics_show_option : Flag<["-"], "fdiagnostics-show-option">, Group<f_Group>,
990991
HelpText<"Print option name with mappable diagnostics">;
991992
def fdiagnostics_show_note_include_stack : Flag<["-"], "fdiagnostics-show-note-include-stack">,

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "clang/Basic/CommentOptions.h"
1515
#include "clang/Basic/DebugInfoOptions.h"
1616
#include "clang/Basic/Diagnostic.h"
17+
#include "clang/Basic/DiagnosticDriver.h"
1718
#include "clang/Basic/DiagnosticOptions.h"
1819
#include "clang/Basic/FileSystemOptions.h"
1920
#include "clang/Basic/LLVM.h"
@@ -66,6 +67,7 @@
6667
#include "llvm/Option/OptTable.h"
6768
#include "llvm/Option/Option.h"
6869
#include "llvm/ProfileData/InstrProfReader.h"
70+
#include "llvm/Remarks/HotnessThresholdParser.h"
6971
#include "llvm/Support/CodeGen.h"
7072
#include "llvm/Support/Compiler.h"
7173
#include "llvm/Support/Error.h"
@@ -1501,11 +1503,24 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
15011503
Diags.Report(diag::warn_drv_diagnostics_hotness_requires_pgo)
15021504
<< "-fdiagnostics-show-hotness";
15031505

1504-
Opts.DiagnosticsHotnessThreshold = getLastArgUInt64Value(
1505-
Args, options::OPT_fdiagnostics_hotness_threshold_EQ, 0);
1506-
if (Opts.DiagnosticsHotnessThreshold > 0 && !UsingProfile)
1507-
Diags.Report(diag::warn_drv_diagnostics_hotness_requires_pgo)
1508-
<< "-fdiagnostics-hotness-threshold=";
1506+
// Parse remarks hotness threshold. Valid value is either integer or 'auto'.
1507+
if (auto *arg =
1508+
Args.getLastArg(options::OPT_fdiagnostics_hotness_threshold_EQ)) {
1509+
auto ResultOrErr =
1510+
llvm::remarks::parseHotnessThresholdOption(arg->getValue());
1511+
1512+
if (!ResultOrErr) {
1513+
Diags.Report(diag::err_drv_invalid_diagnotics_hotness_threshold)
1514+
<< "-fdiagnostics-hotness-threshold=";
1515+
} else {
1516+
Opts.DiagnosticsHotnessThreshold = *ResultOrErr;
1517+
if ((!Opts.DiagnosticsHotnessThreshold.hasValue() ||
1518+
Opts.DiagnosticsHotnessThreshold.getValue() > 0) &&
1519+
!UsingProfile)
1520+
Diags.Report(diag::warn_drv_diagnostics_hotness_requires_pgo)
1521+
<< "-fdiagnostics-hotness-threshold=";
1522+
}
1523+
}
15091524

15101525
// If the user requested to use a sample profile for PGO, then the
15111526
// backend will need to track source location information so the profile

clang/test/Driver/opt-record.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
// RUN: %clang -target x86_64-linux -### -o FOO -fuse-ld=gold -flto -fdiagnostics-hotness-threshold=100 -fsave-optimization-record -foptimization-record-passes=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS
5252
// RUN: %clang -target x86_64-linux -### -o FOO -fuse-ld=lld -flto=thin -fdiagnostics-hotness-threshold=100 -fsave-optimization-record=some-format -foptimization-record-file=FOO.txt %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS-CUSTOM
5353
// RUN: %clang -target x86_64-linux -### -o FOO -fuse-ld=lld -flto=thin -fdiagnostics-hotness-threshold=100 -Rpass=inline -Rpass-missed=inline -Rpass-analysis=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS-RPASS
54+
// RUN: %clang -target x86_64-linux -### -o FOO -fuse-ld=lld -flto=thin -fdiagnostics-hotness-threshold=auto -Rpass=inline -Rpass-missed=inline -Rpass-analysis=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS-AUTO
5455

5556
// CHECK-NOPASS-NOT: "--plugin-opt=opt-remarks-filename="
5657
// CHECK-NOPASS-NOT: "--plugin-opt=opt-remarks-passes=inline"
@@ -75,3 +76,5 @@
7576
// CHECK-PASS-RPASS-SAME: "--plugin-opt=-pass-remarks-missed=inline"
7677
// CHECK-PASS-RPASS-SAME: "--plugin-opt=-pass-remarks-analysis=inline"
7778
// CHECK-PASS-RPASS-SAME: "--plugin-opt=opt-remarks-hotness-threshold=100"
79+
80+
// CHECK-PASS-AUTO: "--plugin-opt=opt-remarks-hotness-threshold=auto"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
_Z7callee1v:600:600
2+
1: 600
3+
_Z7callee2v:1:1
4+
1: 1
5+
_Z7caller1v:400:400
6+
1: 400
7+
_Z7caller2v:1:1
8+
1: 1
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Without hotness threshold, print both hot and cold remarks.
2+
// RUN: %clang_cc1 -triple x86_64-linux %s -emit-llvm-only -O3 \
3+
// RUN: -fprofile-sample-use=%S/Inputs/remarks-hotness.prof \
4+
// RUN: -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline \
5+
// RUN: -fexperimental-new-pass-manager -fdiagnostics-show-hotness 2>&1 \
6+
// RUN: | FileCheck -check-prefix=REMARKS %s
7+
8+
// With auto hotness threshold, only print hot remarks.
9+
// RUN: %clang_cc1 -triple x86_64-linux %s -emit-llvm-only -O3 \
10+
// RUN: -fprofile-sample-use=%S/Inputs/remarks-hotness.prof \
11+
// RUN: -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline \
12+
// RUN: -fexperimental-new-pass-manager -fdiagnostics-show-hotness \
13+
// RUN: -fdiagnostics-hotness-threshold=auto 2>&1 \
14+
// RUN: | FileCheck -check-prefix=HOT_CALL %s
15+
16+
int callee1() {
17+
return 1;
18+
}
19+
20+
__attribute__((noinline)) int callee2() {
21+
return 2;
22+
}
23+
24+
// REMARKS: _Z7callee1v inlined into _Z7caller1v
25+
// HOT_CALL: _Z7callee1v inlined into _Z7caller1v
26+
int caller1() {
27+
return callee1();
28+
}
29+
30+
// REMARKS: _Z7callee2v not inlined into _Z7caller2v
31+
// HOT_CALL-NOT: _Z7callee2v not inlined into _Z7caller2v
32+
int caller2() {
33+
return callee2();
34+
}

llvm/include/llvm/Analysis/ProfileSummaryInfo.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Function;
3838
// units. This would require making this depend on BFI.
3939
class ProfileSummaryInfo {
4040
private:
41-
Module &M;
41+
const Module &M;
4242
std::unique_ptr<ProfileSummary> Summary;
4343
void computeThresholds();
4444
// Count thresholds to answer isHotCount and isColdCount queries.
@@ -58,7 +58,8 @@ class ProfileSummaryInfo {
5858
mutable DenseMap<int, uint64_t> ThresholdCache;
5959

6060
public:
61-
ProfileSummaryInfo(Module &M) : M(M) { refresh(); }
61+
ProfileSummaryInfo(const Module &M) : M(M) { refresh(); }
62+
6263
ProfileSummaryInfo(ProfileSummaryInfo &&Arg) = default;
6364

6465
/// If no summary is present, attempt to refresh.

llvm/include/llvm/IR/LLVMContext.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ class LLVMContext {
237237
/// included in optimization diagnostics.
238238
void setDiagnosticsHotnessThreshold(Optional<uint64_t> Threshold);
239239

240+
/// Return if hotness threshold is requested from PSI.
241+
bool isDiagnosticsHotnessThresholdSetFromPSI() const;
242+
240243
/// The "main remark streamer" used by all the specialized remark streamers.
241244
/// This streamer keeps generic remark metadata in memory throughout the life
242245
/// of the LLVMContext. This metadata may be emitted in a section in object

llvm/include/llvm/IR/Module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ class Module {
850850

851851
/// Returns profile summary metadata. When IsCS is true, use the context
852852
/// sensitive profile summary.
853-
Metadata *getProfileSummary(bool IsCS);
853+
Metadata *getProfileSummary(bool IsCS) const;
854854
/// @}
855855

856856
/// Returns whether semantic interposition is to be respected.

llvm/lib/Analysis/OptimizationRemarkEmitter.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "llvm/Analysis/BranchProbabilityInfo.h"
1616
#include "llvm/Analysis/LazyBlockFrequencyInfo.h"
1717
#include "llvm/Analysis/LoopInfo.h"
18+
#include "llvm/Analysis/ProfileSummaryInfo.h"
1819
#include "llvm/IR/DiagnosticInfo.h"
1920
#include "llvm/IR/Dominators.h"
2021
#include "llvm/IR/LLVMContext.h"
@@ -96,9 +97,17 @@ OptimizationRemarkEmitterWrapperPass::OptimizationRemarkEmitterWrapperPass()
9697
bool OptimizationRemarkEmitterWrapperPass::runOnFunction(Function &Fn) {
9798
BlockFrequencyInfo *BFI;
9899

99-
if (Fn.getContext().getDiagnosticsHotnessRequested())
100+
auto &Context = Fn.getContext();
101+
if (Context.getDiagnosticsHotnessRequested()) {
100102
BFI = &getAnalysis<LazyBlockFrequencyInfoPass>().getBFI();
101-
else
103+
// Get hotness threshold from PSI. This should only happen once.
104+
if (Context.isDiagnosticsHotnessThresholdSetFromPSI()) {
105+
if (ProfileSummaryInfo *PSI =
106+
&getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI())
107+
Context.setDiagnosticsHotnessThreshold(
108+
PSI->getOrCompHotCountThreshold());
109+
}
110+
} else
102111
BFI = nullptr;
103112

104113
ORE = std::make_unique<OptimizationRemarkEmitter>(&Fn, BFI);
@@ -108,6 +117,7 @@ bool OptimizationRemarkEmitterWrapperPass::runOnFunction(Function &Fn) {
108117
void OptimizationRemarkEmitterWrapperPass::getAnalysisUsage(
109118
AnalysisUsage &AU) const {
110119
LazyBlockFrequencyInfoPass::getLazyBFIAnalysisUsage(AU);
120+
AU.addRequired<ProfileSummaryInfoWrapperPass>();
111121
AU.setPreservesAll();
112122
}
113123

@@ -117,10 +127,19 @@ OptimizationRemarkEmitter
117127
OptimizationRemarkEmitterAnalysis::run(Function &F,
118128
FunctionAnalysisManager &AM) {
119129
BlockFrequencyInfo *BFI;
130+
auto &Context = F.getContext();
120131

121-
if (F.getContext().getDiagnosticsHotnessRequested())
132+
if (Context.getDiagnosticsHotnessRequested()) {
122133
BFI = &AM.getResult<BlockFrequencyAnalysis>(F);
123-
else
134+
// Get hotness threshold from PSI. This should only happen once.
135+
if (Context.isDiagnosticsHotnessThresholdSetFromPSI()) {
136+
auto &MAMProxy = AM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
137+
if (ProfileSummaryInfo *PSI =
138+
MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent()))
139+
Context.setDiagnosticsHotnessThreshold(
140+
PSI->getOrCompHotCountThreshold());
141+
}
142+
} else
124143
BFI = nullptr;
125144

126145
return OptimizationRemarkEmitter(&F, BFI);
@@ -133,5 +152,6 @@ static const char ore_name[] = "Optimization Remark Emitter";
133152
INITIALIZE_PASS_BEGIN(OptimizationRemarkEmitterWrapperPass, ORE_NAME, ore_name,
134153
false, true)
135154
INITIALIZE_PASS_DEPENDENCY(LazyBFIPass)
155+
INITIALIZE_PASS_DEPENDENCY(ProfileSummaryInfoWrapperPass)
136156
INITIALIZE_PASS_END(OptimizationRemarkEmitterWrapperPass, ORE_NAME, ore_name,
137157
false, true)

llvm/lib/IR/LLVMContext.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,15 @@ bool LLVMContext::getDiagnosticsHotnessRequested() const {
149149
void LLVMContext::setDiagnosticsHotnessThreshold(Optional<uint64_t> Threshold) {
150150
pImpl->DiagnosticsHotnessThreshold = Threshold;
151151
}
152+
152153
uint64_t LLVMContext::getDiagnosticsHotnessThreshold() const {
153154
return pImpl->DiagnosticsHotnessThreshold.getValueOr(UINT64_MAX);
154155
}
155156

157+
bool LLVMContext::isDiagnosticsHotnessThresholdSetFromPSI() const {
158+
return !pImpl->DiagnosticsHotnessThreshold.hasValue();
159+
}
160+
156161
remarks::RemarkStreamer *LLVMContext::getMainRemarkStreamer() {
157162
return pImpl->MainRemarkStreamer.get();
158163
}

llvm/lib/IR/LLVMRemarkStreamer.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ Expected<std::unique_ptr<ToolOutputFile>> llvm::setupLLVMOptimizationRemarks(
9696
if (RemarksWithHotness)
9797
Context.setDiagnosticsHotnessRequested(true);
9898

99-
if (RemarksHotnessThreshold)
100-
Context.setDiagnosticsHotnessThreshold(RemarksHotnessThreshold);
99+
Context.setDiagnosticsHotnessThreshold(RemarksHotnessThreshold);
101100

102101
if (RemarksFilename.empty())
103102
return nullptr;
@@ -144,8 +143,7 @@ Error llvm::setupLLVMOptimizationRemarks(
144143
if (RemarksWithHotness)
145144
Context.setDiagnosticsHotnessRequested(true);
146145

147-
if (RemarksHotnessThreshold)
148-
Context.setDiagnosticsHotnessThreshold(RemarksHotnessThreshold);
146+
Context.setDiagnosticsHotnessThreshold(RemarksHotnessThreshold);
149147

150148
Expected<remarks::Format> Format = remarks::parseFormat(RemarksFormat);
151149
if (Error E = Format.takeError())

llvm/lib/IR/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ void Module::setProfileSummary(Metadata *M, ProfileSummary::Kind Kind) {
582582
setModuleFlag(ModFlagBehavior::Error, "ProfileSummary", M);
583583
}
584584

585-
Metadata *Module::getProfileSummary(bool IsCS) {
585+
Metadata *Module::getProfileSummary(bool IsCS) const {
586586
return (IsCS ? getModuleFlag("CSProfileSummary")
587587
: getModuleFlag("ProfileSummary"));
588588
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
;; This test verifies 'auto' hotness threshold when profile summary is available.
2+
;;
3+
;; new PM
4+
; RUN: rm -f %t.yaml %t.hot.yaml
5+
; RUN: opt < %s --disable-output --enable-new-pm \
6+
; RUN: --passes='inline' \
7+
; RUN: --pass-remarks-output=%t.yaml --pass-remarks-filter='inline' \
8+
; RUN: --pass-remarks-with-hotness
9+
; RUN: FileCheck %s -check-prefix=YAML-PASS < %t.yaml
10+
; RUN: FileCheck %s -check-prefix=YAML-MISS < %t.yaml
11+
12+
;; test 'auto' threshold
13+
; RUN: opt < %s --disable-output --enable-new-pm \
14+
; RUN: --passes='module(print-profile-summary,cgscc(inline))' \
15+
; RUN: --pass-remarks-output=%t.hot.yaml --pass-remarks-filter='inline' \
16+
; RUN: --pass-remarks-with-hotness --pass-remarks-hotness-threshold=auto 2>&1 | FileCheck %s
17+
; RUN: FileCheck %s -check-prefix=YAML-PASS < %t.hot.yaml
18+
; RUN: not FileCheck %s -check-prefix=YAML-MISS < %t.hot.yaml
19+
20+
; RUN: opt < %s --disable-output --enable-new-pm \
21+
; RUN: --passes='module(print-profile-summary,cgscc(inline))' \
22+
; RUN: --pass-remarks=inline --pass-remarks-missed=inline --pass-remarks-analysis=inline \
23+
; RUN: --pass-remarks-with-hotness --pass-remarks-hotness-threshold=auto 2>&1 | FileCheck %s -check-prefix=CHECK-RPASS
24+
25+
; YAML-PASS: --- !Passed
26+
; YAML-PASS-NEXT: Pass: inline
27+
; YAML-PASS-NEXT: Name: Inlined
28+
; YAML-PASS-NEXT: Function: caller1
29+
; YAML-PASS-NEXT: Hotness: 400
30+
31+
; YAML-MISS: --- !Missed
32+
; YAML-MISS-NEXT: Pass: inline
33+
; YAML-MISS-NEXT: Name: NeverInline
34+
; YAML-MISS-NEXT: Function: caller2
35+
; YAML-MISS-NEXT: Hotness: 1
36+
37+
; CHECK-RPASS: callee1 inlined into caller1 with (cost=-30, threshold=4500) (hotness: 400)
38+
; CHECK-RPASS-NOT: callee2 not inlined into caller2 because it should never be inlined (cost=never): noinline function attribute (hotness: 1)
39+
40+
define void @callee1() !prof !20 {
41+
; CHECK: callee1 :hot
42+
entry:
43+
ret void
44+
}
45+
46+
; Function Attrs: noinline
47+
define void @callee2() noinline !prof !21 {
48+
; CHECK: callee2 :cold
49+
entry:
50+
ret void
51+
}
52+
53+
define void @caller1() !prof !20 {
54+
; CHECK: caller1 :hot
55+
entry:
56+
call void @callee1()
57+
ret void
58+
}
59+
60+
define void @caller2() !prof !21 {
61+
; CHECK: caller2 :cold
62+
entry:
63+
call void @callee2()
64+
ret void
65+
}
66+
67+
!llvm.module.flags = !{!1}
68+
!20 = !{!"function_entry_count", i64 400}
69+
!21 = !{!"function_entry_count", i64 1}
70+
71+
!1 = !{i32 1, !"ProfileSummary", !2}
72+
!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
73+
!3 = !{!"ProfileFormat", !"InstrProf"}
74+
!4 = !{!"TotalCount", i64 10000}
75+
!5 = !{!"MaxCount", i64 10}
76+
!6 = !{!"MaxInternalCount", i64 1}
77+
!7 = !{!"MaxFunctionCount", i64 1000}
78+
!8 = !{!"NumCounts", i64 3}
79+
!9 = !{!"NumFunctions", i64 3}
80+
!10 = !{!"DetailedSummary", !11}
81+
!11 = !{!12, !13, !14}
82+
!12 = !{i32 10000, i64 100, i32 1}
83+
!13 = !{i32 999000, i64 100, i32 1}
84+
!14 = !{i32 999999, i64 1, i32 2}
85+

0 commit comments

Comments
 (0)