Skip to content

Commit faf675c

Browse files
[llvm-exegesis] Remove llvm prefix where unnecessary (#79802)
This patch removes the llvm:: prefix within llvm-exegesis where it is not necessary. This is most occurrences of the prefix within exegesis as exegesis is within the llvm namespace. This patch makes things more consistent as the vast majority of the code did not use the llvm:: prefix for anything.
1 parent 0039a2f commit faf675c

19 files changed

+123
-135
lines changed

llvm/tools/llvm-exegesis/lib/Analysis.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,7 @@ static void writeLatencySnippetHtml(raw_ostream &OS,
254254
}
255255
}
256256

257-
void Analysis::printPointHtml(const Benchmark &Point,
258-
llvm::raw_ostream &OS) const {
257+
void Analysis::printPointHtml(const Benchmark &Point, raw_ostream &OS) const {
259258
OS << "<li><span class=\"mono\" title=\"";
260259
writeSnippet<EscapeTag, kEscapeHtmlString>(OS, Point.AssembledSnippet, "\n");
261260
OS << "\">";
@@ -410,9 +409,9 @@ void Analysis::printSchedClassDescHtml(const ResolvedSchedClass &RSC,
410409
OS << "</table>";
411410
}
412411

413-
void Analysis::printClusterRawHtml(
414-
const BenchmarkClustering::ClusterId &Id, StringRef display_name,
415-
llvm::raw_ostream &OS) const {
412+
void Analysis::printClusterRawHtml(const BenchmarkClustering::ClusterId &Id,
413+
StringRef display_name,
414+
raw_ostream &OS) const {
416415
const auto &Points = Clustering_.getPoints();
417416
const auto &Cluster = Clustering_.getCluster(Id);
418417
if (Cluster.PointIndices.empty())
@@ -538,8 +537,8 @@ Error Analysis::run<Analysis::PrintSchedClassInconsistencies>(
538537
continue; // Ignore noise and errors. FIXME: take noise into account ?
539538
if (ClusterId.isUnstable() ^ AnalysisDisplayUnstableOpcodes_)
540539
continue; // Either display stable or unstable clusters only.
541-
auto SchedClassClusterIt = llvm::find_if(
542-
SchedClassClusters, [ClusterId](const SchedClassCluster &C) {
540+
auto SchedClassClusterIt =
541+
find_if(SchedClassClusters, [ClusterId](const SchedClassCluster &C) {
543542
return C.id() == ClusterId;
544543
});
545544
if (SchedClassClusterIt == SchedClassClusters.end()) {

llvm/tools/llvm-exegesis/lib/Analysis.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ class Analysis {
7676
void printInstructionRowCsv(size_t PointId, raw_ostream &OS) const;
7777

7878
void printClusterRawHtml(const BenchmarkClustering::ClusterId &Id,
79-
StringRef display_name, llvm::raw_ostream &OS) const;
79+
StringRef display_name, raw_ostream &OS) const;
8080

81-
void printPointHtml(const Benchmark &Point,
82-
llvm::raw_ostream &OS) const;
81+
void printPointHtml(const Benchmark &Point, raw_ostream &OS) const;
8382

8483
void
8584
printSchedClassClustersHtml(const std::vector<SchedClassCluster> &Clusters,

llvm/tools/llvm-exegesis/lib/Assembler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,14 @@ Expected<ExecutableFunction> ExecutableFunction::create(
366366
auto SymbolSizes = object::computeSymbolSizes(*ObjectFileHolder.getBinary());
367367
// Get the size of the function that we want to call into (with the name of
368368
// FunctionID).
369-
auto SymbolIt = llvm::find_if(SymbolSizes, [&](const auto &Pair) {
369+
auto SymbolIt = find_if(SymbolSizes, [&](const auto &Pair) {
370370
auto SymbolName = Pair.first.getName();
371371
if (SymbolName)
372372
return *SymbolName == FunctionID;
373373
// We should always succeed in finding the FunctionID, hence we suppress
374374
// the error here and assert later on the search result, rather than
375375
// propagating the Expected<> error back to the caller.
376-
llvm::consumeError(SymbolName.takeError());
376+
consumeError(SymbolName.takeError());
377377
return false;
378378
});
379379
assert(SymbolIt != SymbolSizes.end() &&

llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ BenchmarkRunner::BenchmarkRunner(const LLVMState &State, Benchmark::ModeE Mode,
6363
BenchmarkRunner::~BenchmarkRunner() = default;
6464

6565
void BenchmarkRunner::FunctionExecutor::accumulateCounterValues(
66-
const llvm::SmallVectorImpl<int64_t> &NewValues,
67-
llvm::SmallVectorImpl<int64_t> *Result) {
66+
const SmallVectorImpl<int64_t> &NewValues,
67+
SmallVectorImpl<int64_t> *Result) {
6868
const size_t NumValues = std::max(NewValues.size(), Result->size());
6969
if (NumValues > Result->size())
7070
Result->resize(NumValues, 0);
7171
for (size_t I = 0, End = NewValues.size(); I < End; ++I)
7272
(*Result)[I] += NewValues[I];
7373
}
7474

75-
Expected<llvm::SmallVector<int64_t, 4>>
75+
Expected<SmallVector<int64_t, 4>>
7676
BenchmarkRunner::FunctionExecutor::runAndSample(
7777
const char *Counters, ArrayRef<const char *> ValidationCounters,
7878
SmallVectorImpl<int64_t> &ValidationCounterValues) const {
7979
// We sum counts when there are several counters for a single ProcRes
8080
// (e.g. P23 on SandyBridge).
81-
llvm::SmallVector<int64_t, 4> CounterValues;
81+
SmallVector<int64_t, 4> CounterValues;
8282
SmallVector<StringRef, 2> CounterNames;
8383
StringRef(Counters).split(CounterNames, '+');
8484
for (auto &CounterName : CounterNames) {
@@ -114,17 +114,16 @@ class InProcessFunctionExecutorImpl : public BenchmarkRunner::FunctionExecutor {
114114
BenchmarkRunner::ScratchSpace *Scratch)
115115
: State(State), Function(std::move(Function)), Scratch(Scratch) {}
116116

117-
static void
118-
accumulateCounterValues(const llvm::SmallVector<int64_t, 4> &NewValues,
119-
llvm::SmallVector<int64_t, 4> *Result) {
117+
static void accumulateCounterValues(const SmallVector<int64_t, 4> &NewValues,
118+
SmallVector<int64_t, 4> *Result) {
120119
const size_t NumValues = std::max(NewValues.size(), Result->size());
121120
if (NumValues > Result->size())
122121
Result->resize(NumValues, 0);
123122
for (size_t I = 0, End = NewValues.size(); I < End; ++I)
124123
(*Result)[I] += NewValues[I];
125124
}
126125

127-
Expected<llvm::SmallVector<int64_t, 4>> runWithCounter(
126+
Expected<SmallVector<int64_t, 4>> runWithCounter(
128127
StringRef CounterName, ArrayRef<const char *> ValidationCounters,
129128
SmallVectorImpl<int64_t> &ValidationCounterValues) const override {
130129
const ExegesisTarget &ET = State.getExegesisTarget();
@@ -314,7 +313,7 @@ class SubProcessFunctionExecutorImpl
314313
close(PipeFiles[1]);
315314
// Unregister handlers, signal handling is now handled through ptrace in
316315
// the host process
317-
llvm::sys::unregisterHandlers();
316+
sys::unregisterHandlers();
318317
prepareAndRunBenchmark(PipeFiles[0], Key);
319318
// The child process terminates in the above function, so we should never
320319
// get to this point.
@@ -484,7 +483,7 @@ class SubProcessFunctionExecutorImpl
484483
exit(0);
485484
}
486485

487-
Expected<llvm::SmallVector<int64_t, 4>> runWithCounter(
486+
Expected<SmallVector<int64_t, 4>> runWithCounter(
488487
StringRef CounterName, ArrayRef<const char *> ValidationCounters,
489488
SmallVectorImpl<int64_t> &ValidationCounterValues) const override {
490489
SmallVector<int64_t, 4> Value(1, 0);

llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,16 @@ class BenchmarkRunner {
9393
public:
9494
virtual ~FunctionExecutor();
9595

96-
Expected<llvm::SmallVector<int64_t, 4>>
96+
Expected<SmallVector<int64_t, 4>>
9797
runAndSample(const char *Counters,
9898
ArrayRef<const char *> ValidationCounters,
9999
SmallVectorImpl<int64_t> &ValidationCounterValues) const;
100100

101101
protected:
102102
static void
103-
accumulateCounterValues(const llvm::SmallVectorImpl<int64_t> &NewValues,
104-
llvm::SmallVectorImpl<int64_t> *Result);
105-
virtual Expected<llvm::SmallVector<int64_t, 4>>
103+
accumulateCounterValues(const SmallVectorImpl<int64_t> &NewValues,
104+
SmallVectorImpl<int64_t> *Result);
105+
virtual Expected<SmallVector<int64_t, 4>>
106106
runWithCounter(StringRef CounterName,
107107
ArrayRef<const char *> ValidationCounters,
108108
SmallVectorImpl<int64_t> &ValidationCounterValues) const = 0;

llvm/tools/llvm-exegesis/lib/Clustering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void BenchmarkClustering::stabilize(unsigned NumOpcodes) {
307307
assert(std::distance(it, OldCluster.PointIndices.end()) > 0 &&
308308
"Should have found at least one bad point");
309309
// Mark to-be-moved points as belonging to the new cluster.
310-
for (size_t P : llvm::make_range(it, OldCluster.PointIndices.end()))
310+
for (size_t P : make_range(it, OldCluster.PointIndices.end()))
311311
ClusterIdForPoint_[P] = UnstableCluster.Id;
312312
// Actually append to-be-moved points to the new cluster.
313313
UnstableCluster.PointIndices.insert(UnstableCluster.PointIndices.end(),

llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ LatencyBenchmarkRunner::LatencyBenchmarkRunner(
3333

3434
LatencyBenchmarkRunner::~LatencyBenchmarkRunner() = default;
3535

36-
static double computeVariance(const llvm::SmallVector<int64_t, 4> &Values) {
36+
static double computeVariance(const SmallVector<int64_t, 4> &Values) {
3737
if (Values.empty())
3838
return 0.0;
3939
double Sum = std::accumulate(Values.begin(), Values.end(), 0.0);
@@ -47,19 +47,19 @@ static double computeVariance(const llvm::SmallVector<int64_t, 4> &Values) {
4747
return Ret / Values.size();
4848
}
4949

50-
static int64_t findMin(const llvm::SmallVector<int64_t, 4> &Values) {
50+
static int64_t findMin(const SmallVector<int64_t, 4> &Values) {
5151
if (Values.empty())
5252
return 0;
5353
return *std::min_element(Values.begin(), Values.end());
5454
}
5555

56-
static int64_t findMax(const llvm::SmallVector<int64_t, 4> &Values) {
56+
static int64_t findMax(const SmallVector<int64_t, 4> &Values) {
5757
if (Values.empty())
5858
return 0;
5959
return *std::max_element(Values.begin(), Values.end());
6060
}
6161

62-
static int64_t findMean(const llvm::SmallVector<int64_t, 4> &Values) {
62+
static int64_t findMean(const SmallVector<int64_t, 4> &Values) {
6363
if (Values.empty())
6464
return 0;
6565
return std::accumulate(Values.begin(), Values.end(), 0.0) /
@@ -71,7 +71,7 @@ Expected<std::vector<BenchmarkMeasure>> LatencyBenchmarkRunner::runMeasurements(
7171
// Cycle measurements include some overhead from the kernel. Repeat the
7272
// measure several times and return the aggregated value, as specified by
7373
// ResultAggMode.
74-
llvm::SmallVector<int64_t, 4> AccumulatedValues;
74+
SmallVector<int64_t, 4> AccumulatedValues;
7575
double MinVariance = std::numeric_limits<double>::infinity();
7676
const PfmCountersInfo &PCI = State.getPfmCounters();
7777
const char *CounterName = PCI.CycleCounter;
@@ -125,8 +125,8 @@ Expected<std::vector<BenchmarkMeasure>> LatencyBenchmarkRunner::runMeasurements(
125125
switch (ResultAggMode) {
126126
case Benchmark::MinVariance: {
127127
if (ValuesCount == 1)
128-
llvm::errs() << "Each sample only has one value. result-aggregation-mode "
129-
"of min-variance is probably non-sensical\n";
128+
errs() << "Each sample only has one value. result-aggregation-mode "
129+
"of min-variance is probably non-sensical\n";
130130
std::vector<BenchmarkMeasure> Result;
131131
Result.reserve(AccumulatedValues.size());
132132
for (const int64_t Value : AccumulatedValues)
@@ -153,10 +153,10 @@ Expected<std::vector<BenchmarkMeasure>> LatencyBenchmarkRunner::runMeasurements(
153153
return std::move(Result);
154154
}
155155
}
156-
return llvm::make_error<Failure>(llvm::Twine("Unexpected benchmark mode(")
157-
.concat(std::to_string(Mode))
158-
.concat(" and unexpected ResultAggMode ")
159-
.concat(std::to_string(ResultAggMode)));
156+
return make_error<Failure>(Twine("Unexpected benchmark mode(")
157+
.concat(std::to_string(Mode))
158+
.concat(" and unexpected ResultAggMode ")
159+
.concat(std::to_string(ResultAggMode)));
160160
}
161161

162162
} // namespace exegesis

llvm/tools/llvm-exegesis/lib/LlvmState.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,43 +35,42 @@ Expected<LLVMState> LLVMState::Create(std::string TripleName,
3535
const Target *TheTarget =
3636
TargetRegistry::lookupTarget(/*MArch=*/"", TheTriple, Error);
3737
if (!TheTarget) {
38-
return llvm::make_error<llvm::StringError>("no LLVM target for triple " +
39-
TripleName,
40-
llvm::inconvertibleErrorCode());
38+
return make_error<StringError>("no LLVM target for triple " + TripleName,
39+
inconvertibleErrorCode());
4140
}
4241

4342
// Update Triple with the updated triple from the target lookup.
4443
TripleName = TheTriple.str();
4544

4645
if (CpuName == "native")
47-
CpuName = std::string(llvm::sys::getHostCPUName());
46+
CpuName = std::string(sys::getHostCPUName());
4847

4948
std::unique_ptr<MCSubtargetInfo> STI(
5049
TheTarget->createMCSubtargetInfo(TripleName, CpuName, ""));
5150
assert(STI && "Unable to create subtarget info!");
5251
if (!STI->isCPUStringValid(CpuName)) {
53-
return llvm::make_error<llvm::StringError>(Twine("invalid CPU name (")
54-
.concat(CpuName)
55-
.concat(") for triple ")
56-
.concat(TripleName),
57-
llvm::inconvertibleErrorCode());
52+
return make_error<StringError>(Twine("invalid CPU name (")
53+
.concat(CpuName)
54+
.concat(") for triple ")
55+
.concat(TripleName),
56+
inconvertibleErrorCode());
5857
}
5958
const TargetOptions Options;
6059
std::unique_ptr<const TargetMachine> TM(
6160
static_cast<LLVMTargetMachine *>(TheTarget->createTargetMachine(
6261
TripleName, CpuName, Features, Options, Reloc::Model::Static)));
6362
if (!TM) {
64-
return llvm::make_error<llvm::StringError>(
65-
"unable to create target machine", llvm::inconvertibleErrorCode());
63+
return make_error<StringError>("unable to create target machine",
64+
inconvertibleErrorCode());
6665
}
6766

6867
const ExegesisTarget *ET =
6968
TripleName.empty() ? &ExegesisTarget::getDefault()
7069
: ExegesisTarget::lookup(TM->getTargetTriple());
7170
if (!ET) {
72-
return llvm::make_error<llvm::StringError>(
73-
"no Exegesis target for triple " + TripleName,
74-
llvm::inconvertibleErrorCode());
71+
return make_error<StringError>("no Exegesis target for triple " +
72+
TripleName,
73+
inconvertibleErrorCode());
7574
}
7675
const PfmCountersInfo &PCI = UseDummyPerfCounters
7776
? ET->getDummyPfmCounters()

llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ std::unique_ptr<Instruction>
105105
Instruction::create(const MCInstrInfo &InstrInfo,
106106
const RegisterAliasingTrackerCache &RATC,
107107
const BitVectorCache &BVC, unsigned Opcode) {
108-
const llvm::MCInstrDesc *const Description = &InstrInfo.get(Opcode);
108+
const MCInstrDesc *const Description = &InstrInfo.get(Opcode);
109109
unsigned OpIndex = 0;
110110
SmallVector<Operand, 8> Operands;
111111
SmallVector<Variable, 4> Variables;

llvm/tools/llvm-exegesis/lib/Mips/Target.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ExegesisMipsTarget : public ExegesisTarget {
5858
: ExegesisTarget(MipsCpuPfmCounters, Mips_MC::isOpcodeAvailable) {}
5959

6060
private:
61-
unsigned getScratchMemoryRegister(const llvm::Triple &TT) const override;
61+
unsigned getScratchMemoryRegister(const Triple &TT) const override;
6262
unsigned getMaxMemoryAccessSize() const override { return 64; }
6363
void fillMemoryOperands(InstructionTemplate &IT, unsigned Reg,
6464
unsigned Offset) const override;

llvm/tools/llvm-exegesis/lib/PerfHelper.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ ConfiguredEvent::readOrError(StringRef /*unused*/) const {
136136
ssize_t ReadSize = ::read(FileDescriptor, &Count, sizeof(Count));
137137

138138
if (ReadSize != sizeof(Count))
139-
return llvm::make_error<llvm::StringError>("Failed to read event counter",
140-
llvm::errc::io_error);
139+
return make_error<StringError>("Failed to read event counter",
140+
errc::io_error);
141141

142142
SmallVector<int64_t, 1> Result;
143143
Result.push_back(Count);
@@ -187,17 +187,17 @@ void CounterGroup::stop() {
187187
ioctl(getFileDescriptor(), PERF_EVENT_IOC_DISABLE, PERF_IOC_FLAG_GROUP);
188188
}
189189

190-
llvm::Expected<llvm::SmallVector<int64_t, 4>>
190+
Expected<SmallVector<int64_t, 4>>
191191
CounterGroup::readOrError(StringRef FunctionBytes) const {
192192
if (!IsDummyEvent)
193193
return EventCounter.readOrError(FunctionBytes);
194194
else
195195
return SmallVector<int64_t, 1>(1, 42);
196196
}
197197

198-
llvm::Expected<llvm::SmallVector<int64_t>>
198+
Expected<SmallVector<int64_t>>
199199
CounterGroup::readValidationCountersOrError() const {
200-
llvm::SmallVector<int64_t, 4> Result;
200+
SmallVector<int64_t, 4> Result;
201201
for (const auto &ValCounter : ValidationEventCounters) {
202202
Expected<SmallVector<int64_t>> ValueOrError =
203203
ValCounter.readOrError(StringRef());
@@ -223,18 +223,17 @@ void CounterGroup::start() {}
223223

224224
void CounterGroup::stop() {}
225225

226-
llvm::Expected<llvm::SmallVector<int64_t, 4>>
226+
Expected<SmallVector<int64_t, 4>>
227227
CounterGroup::readOrError(StringRef /*unused*/) const {
228228
if (IsDummyEvent) {
229-
llvm::SmallVector<int64_t, 4> Result;
229+
SmallVector<int64_t, 4> Result;
230230
Result.push_back(42);
231231
return Result;
232232
}
233-
return llvm::make_error<llvm::StringError>("Not implemented",
234-
llvm::errc::io_error);
233+
return make_error<StringError>("Not implemented", errc::io_error);
235234
}
236235

237-
llvm::Expected<llvm::SmallVector<int64_t>>
236+
Expected<SmallVector<int64_t>>
238237
CounterGroup::readValidationCountersOrError() const {
239238
return SmallVector<int64_t>(0);
240239
}

llvm/tools/llvm-exegesis/lib/PerfHelper.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,10 @@ class CounterGroup {
127127
/// within the benchmarked code.
128128
/// If empty (or not specified), then no filtering will be done.
129129
/// Not all counters choose to use this.
130-
virtual llvm::Expected<llvm::SmallVector<int64_t, 4>>
130+
virtual Expected<SmallVector<int64_t, 4>>
131131
readOrError(StringRef FunctionBytes = StringRef()) const;
132132

133-
virtual llvm::Expected<llvm::SmallVector<int64_t>>
134-
readValidationCountersOrError() const;
133+
virtual Expected<SmallVector<int64_t>> readValidationCountersOrError() const;
135134

136135
virtual int numValues() const;
137136

llvm/tools/llvm-exegesis/lib/ProgressMeter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class ProgressMeter {
9292
ProgressMeterStep &operator=(ProgressMeterStep &&) = delete;
9393
};
9494

95-
ProgressMeter(int NumStepsTotal_, raw_ostream &out_ = llvm::errs())
95+
ProgressMeter(int NumStepsTotal_, raw_ostream &out_ = errs())
9696
: Out(out_), NumStepsTotal(NumStepsTotal_) {
9797
assert(NumStepsTotal > 0 && "No steps are planned?");
9898
}

0 commit comments

Comments
 (0)