Skip to content

Commit d08833f

Browse files
[BOLT] Remove unused local variables (NFC) (#140421)
While I'm at it, this patch removes GetExecutablePath, which becomes unused after removing the sole use.
1 parent 3360a23 commit d08833f

File tree

5 files changed

+0
-15
lines changed

5 files changed

+0
-15
lines changed

bolt/lib/Core/DebugData.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ static void writeDWARF5LocList(uint32_t &NumberOfEntries, DIEValue &AttrInfo,
676676
return;
677677
}
678678

679-
std::vector<uint64_t> OffsetsArray;
680679
auto writeExpression = [&](uint32_t Index) -> void {
681680
const DebugLocationEntry &Entry = LocList[Index];
682681
encodeULEB128(Entry.Expr.size(), LocBodyStream);

bolt/lib/Passes/FrameAnalysis.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ bool FrameAnalysis::updateArgsTouchedFor(const BinaryFunction &BF, MCInst &Inst,
320320
if (!BC.MIB->isCall(Inst))
321321
return false;
322322

323-
std::set<int64_t> Res;
324323
const MCSymbol *TargetSymbol = BC.MIB->getTargetSymbol(Inst);
325324
// If indirect call, we conservatively assume it accesses all stack positions
326325
if (TargetSymbol == nullptr) {

bolt/lib/Passes/HFSort.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ std::vector<Cluster> clusterize(const CallGraph &Cg) {
239239
}
240240

241241
std::vector<Cluster> randomClusters(const CallGraph &Cg) {
242-
std::vector<NodeId> FuncIds(Cg.numNodes(), 0);
243242
std::vector<Cluster> Clusters;
244243
Clusters.reserve(Cg.numNodes());
245244

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4703,7 +4703,6 @@ RewriteInstance::getOutputSections(ELFObjectFile<ELFT> *File,
47034703
}
47044704

47054705
// Assign indices to sections.
4706-
std::unordered_map<std::string, uint64_t> NameToIndex;
47074706
for (uint32_t Index = 1; Index < OutputSections.size(); ++Index)
47084707
OutputSections[Index].first->setIndex(Index);
47094708

bolt/tools/bat-dump/bat-dump.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,6 @@ static void report_error(StringRef Message, Error E) {
7373
exit(1);
7474
}
7575

76-
static std::string GetExecutablePath(const char *Argv0) {
77-
SmallString<256> ExecutablePath(Argv0);
78-
// Do a PATH lookup if Argv0 isn't a valid path.
79-
if (!llvm::sys::fs::exists(ExecutablePath))
80-
if (llvm::ErrorOr<std::string> P =
81-
llvm::sys::findProgramByName(ExecutablePath))
82-
ExecutablePath = *P;
83-
return std::string(ExecutablePath);
84-
}
85-
8676
void dumpBATFor(llvm::object::ELFObjectFileBase *InputFile) {
8777
BoltAddressTranslation BAT;
8878
if (!BAT.enabledFor(InputFile)) {
@@ -163,7 +153,6 @@ int main(int argc, char **argv) {
163153
report_error(opts::InputFilename, errc::no_such_file_or_directory);
164154

165155
ToolName = argv[0];
166-
std::string ToolPath = GetExecutablePath(argv[0]);
167156
Expected<llvm::object::OwningBinary<llvm::object::Binary>> BinaryOrErr =
168157
llvm::object::createBinary(opts::InputFilename);
169158
if (Error E = BinaryOrErr.takeError())

0 commit comments

Comments
 (0)