Skip to content

Commit c820bd3

Browse files
authored
[BOLT][NFC] Rename profile-use-pseudo-probes
The flag currently controls writing of probe information in YAML profile. llvm#99891 adds a separate flag to use probe information for stale profile matching. Thus `profile-use-pseudo-probes` becomes a misnomer and `profile-write-pseudo-probes` better captures the intent. Reviewers: maksfb, WenleiHe, ayermolo, rafaelauler, dcci Reviewed By: rafaelauler Pull Request: llvm#106364
1 parent 34e20f1 commit c820bd3

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ MaxSamples("max-samples",
8888
cl::cat(AggregatorCategory));
8989

9090
extern cl::opt<opts::ProfileFormatKind> ProfileFormat;
91-
extern cl::opt<bool> ProfileUsePseudoProbes;
91+
extern cl::opt<bool> ProfileWritePseudoProbes;
9292
extern cl::opt<std::string> SaveProfile;
9393

9494
cl::opt<bool> ReadPreAggregated(
@@ -2300,7 +2300,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
23002300
yaml::bolt::BinaryProfile BP;
23012301

23022302
const MCPseudoProbeDecoder *PseudoProbeDecoder =
2303-
opts::ProfileUsePseudoProbes ? BC.getPseudoProbeDecoder() : nullptr;
2303+
opts::ProfileWritePseudoProbes ? BC.getPseudoProbeDecoder() : nullptr;
23042304

23052305
// Fill out the header info.
23062306
BP.Header.Version = 1;

bolt/lib/Profile/YAMLProfileReader.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ llvm::cl::opt<bool>
4949
llvm::cl::opt<bool> ProfileUseDFS("profile-use-dfs",
5050
cl::desc("use DFS order for YAML profile"),
5151
cl::Hidden, cl::cat(BoltOptCategory));
52-
53-
llvm::cl::opt<bool> ProfileUsePseudoProbes(
54-
"profile-use-pseudo-probes",
55-
cl::desc("Use pseudo probes for profile generation and matching"),
56-
cl::Hidden, cl::cat(BoltOptCategory));
5752
} // namespace opts
5853

5954
namespace llvm {

bolt/lib/Profile/YAMLProfileWriter.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "bolt/Profile/DataAggregator.h"
1414
#include "bolt/Profile/ProfileReaderBase.h"
1515
#include "bolt/Rewrite/RewriteInstance.h"
16+
#include "bolt/Utils/CommandLineOpts.h"
1617
#include "llvm/Support/CommandLine.h"
1718
#include "llvm/Support/FileSystem.h"
1819
#include "llvm/Support/raw_ostream.h"
@@ -21,8 +22,12 @@
2122
#define DEBUG_TYPE "bolt-prof"
2223

2324
namespace opts {
24-
extern llvm::cl::opt<bool> ProfileUseDFS;
25-
extern llvm::cl::opt<bool> ProfileUsePseudoProbes;
25+
using namespace llvm;
26+
extern cl::opt<bool> ProfileUseDFS;
27+
cl::opt<bool> ProfileWritePseudoProbes(
28+
"profile-write-pseudo-probes",
29+
cl::desc("Use pseudo probes in profile generation"), cl::Hidden,
30+
cl::cat(BoltOptCategory));
2631
} // namespace opts
2732

2833
namespace llvm {
@@ -59,7 +64,7 @@ YAMLProfileWriter::convert(const BinaryFunction &BF, bool UseDFS,
5964
yaml::bolt::BinaryFunctionProfile YamlBF;
6065
const BinaryContext &BC = BF.getBinaryContext();
6166
const MCPseudoProbeDecoder *PseudoProbeDecoder =
62-
opts::ProfileUsePseudoProbes ? BC.getPseudoProbeDecoder() : nullptr;
67+
opts::ProfileWritePseudoProbes ? BC.getPseudoProbeDecoder() : nullptr;
6368

6469
const uint16_t LBRProfile = BF.getProfileFlags() & BinaryFunction::PF_LBR;
6570

bolt/lib/Rewrite/PseudoProbeRewriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static cl::opt<PrintPseudoProbesOptions> PrintPseudoProbes(
5050
clEnumValN(PPP_All, "all", "enable all debugging printout")),
5151
cl::Hidden, cl::cat(BoltCategory));
5252

53-
extern cl::opt<bool> ProfileUsePseudoProbes;
53+
extern cl::opt<bool> ProfileWritePseudoProbes;
5454
} // namespace opts
5555

5656
namespace {
@@ -91,14 +91,14 @@ class PseudoProbeRewriter final : public MetadataRewriter {
9191
};
9292

9393
Error PseudoProbeRewriter::preCFGInitializer() {
94-
if (opts::ProfileUsePseudoProbes)
94+
if (opts::ProfileWritePseudoProbes)
9595
parsePseudoProbe();
9696

9797
return Error::success();
9898
}
9999

100100
Error PseudoProbeRewriter::postEmitFinalizer() {
101-
if (!opts::ProfileUsePseudoProbes)
101+
if (!opts::ProfileWritePseudoProbes)
102102
parsePseudoProbe();
103103
updatePseudoProbes();
104104

bolt/test/X86/pseudoprobe-decoding-inline.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
# PREAGG: B X:0 #main# 1 0
77
## Check pseudo-probes in regular YAML profile (non-BOLTed binary)
88
# RUN: link_fdata %s %S/../../../llvm/test/tools/llvm-profgen/Inputs/inline-cs-pseudoprobe.perfbin %t.preagg PREAGG
9-
# RUN: perf2bolt %S/../../../llvm/test/tools/llvm-profgen/Inputs/inline-cs-pseudoprobe.perfbin -p %t.preagg --pa -w %t.yaml -o %t.fdata --profile-use-pseudo-probes
9+
# RUN: perf2bolt %S/../../../llvm/test/tools/llvm-profgen/Inputs/inline-cs-pseudoprobe.perfbin -p %t.preagg --pa -w %t.yaml -o %t.fdata --profile-write-pseudo-probes
1010
# RUN: FileCheck --input-file %t.yaml %s --check-prefix CHECK-YAML
1111
## Check pseudo-probes in BAT YAML profile (BOLTed binary)
1212
# RUN: link_fdata %s %t.bolt %t.preagg2 PREAGG
13-
# RUN: perf2bolt %t.bolt -p %t.preagg2 --pa -w %t.yaml2 -o %t.fdata2 --profile-use-pseudo-probes
13+
# RUN: perf2bolt %t.bolt -p %t.preagg2 --pa -w %t.yaml2 -o %t.fdata2 --profile-write-pseudo-probes
1414
# RUN: FileCheck --input-file %t.yaml2 %s --check-prefix CHECK-YAML
1515
# CHECK-YAML: name: bar
1616
# CHECK-YAML: - bid: 0
@@ -30,7 +30,7 @@
3030
# CHECK-YAML: guid: 0xDB956436E78DD5FA
3131
# CHECK-YAML: pseudo_probe_desc_hash: 0x10000FFFFFFFF
3232
#
33-
## Check that without --profile-use-pseudo-probes option, no pseudo probes are
33+
## Check that without --profile-write-pseudo-probes option, no pseudo probes are
3434
## generated
3535
# RUN: perf2bolt %S/../../../llvm/test/tools/llvm-profgen/Inputs/inline-cs-pseudoprobe.perfbin -p %t.preagg --pa -w %t.yaml -o %t.fdata
3636
# RUN: FileCheck --input-file %t.yaml %s --check-prefix CHECK-NO-OPT

0 commit comments

Comments
 (0)