diff options
author | Maksim Panchenko <maks@fb.com> | 2021-12-14 16:52:51 -0800 |
---|---|---|
committer | Maksim Panchenko <maks@fb.com> | 2021-12-14 16:52:51 -0800 |
commit | 40c2e0fafe5675306f4ad43910bf6e2fd2025ff3 (patch) | |
tree | 6836c91cc86d98569f486373381beeab138e2319 /bolt/tools | |
parent | 5fc8adb529d667131c6bcb413cf0621f5b5d20c4 (diff) | |
download | llvm-40c2e0fafe5675306f4ad43910bf6e2fd2025ff3.tar.gz |
[BOLT][NFC] Reformat with clang-format
Summary: Selectively apply clang-format to BOLT code base.
(cherry picked from FBD33119052)
Diffstat (limited to 'bolt/tools')
-rw-r--r-- | bolt/tools/driver/llvm-bolt.cpp | 12 | ||||
-rw-r--r-- | bolt/tools/merge-fdata/merge-fdata.cpp | 64 |
2 files changed, 32 insertions, 44 deletions
diff --git a/bolt/tools/driver/llvm-bolt.cpp b/bolt/tools/driver/llvm-bolt.cpp index 6bafc2333c55..1e44f9718861 100644 --- a/bolt/tools/driver/llvm-bolt.cpp +++ b/bolt/tools/driver/llvm-bolt.cpp @@ -26,7 +26,6 @@ #include "llvm/Support/Signals.h" #include "llvm/Support/TargetSelect.h" -#undef DEBUG_TYPE #define DEBUG_TYPE "bolt" using namespace llvm; @@ -126,7 +125,7 @@ void heatmapMode(int argc, char **argv) { std::unique_ptr<char *[]> FakeArgv; if (argc == 1 || strcmp(argv[1], "heatmap")) { ++argc; - FakeArgv.reset(new char *[argc+1]); + FakeArgv.reset(new char *[argc + 1]); FakeArgv[0] = argv[0]; FakeArgv[1] = const_cast<char *>("heatmap"); for (int I = 2; I < argc; ++I) @@ -205,7 +204,7 @@ int main(int argc, char **argv) { sys::PrintStackTraceOnErrorSignal(argv[0]); PrettyStackTraceProgram X(argc, argv); - llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. + llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. std::string ToolPath = GetExecutablePath(argv[0]); @@ -236,7 +235,6 @@ int main(int argc, char **argv) { else boltMode(argc, argv); - if (!sys::fs::exists(opts::InputFilename)) report_error(opts::InputFilename, errc::no_such_file_or_directory); @@ -253,8 +251,10 @@ int main(int argc, char **argv) { if (!opts::PerfData.empty()) { if (!opts::AggregateOnly) { errs() << ToolName - << ": WARNING: reading perf data directly is unsupported, please use " - "-aggregate-only or perf2bolt.\n!!! Proceed on your own risk. !!!\n"; + << ": WARNING: reading perf data directly is unsupported, " + "please use " + "-aggregate-only or perf2bolt.\n!!! Proceed on your own " + "risk. !!!\n"; } if (Error E = RI.setProfile(opts::PerfData)) report_error(opts::PerfData, std::move(E)); diff --git a/bolt/tools/merge-fdata/merge-fdata.cpp b/bolt/tools/merge-fdata/merge-fdata.cpp index 0f4aa1fc4da8..8e3668b5e202 100644 --- a/bolt/tools/merge-fdata/merge-fdata.cpp +++ b/bolt/tools/merge-fdata/merge-fdata.cpp @@ -85,9 +85,8 @@ void mergeProfileHeaders(BinaryProfileHeader &MergedHeader, } if (!MergedHeader.FileName.empty() && MergedHeader.FileName != Header.FileName) { - errs() << "WARNING: merging profile from a binary for " - << Header.FileName << " into a profile for binary " - << MergedHeader.FileName << '\n'; + errs() << "WARNING: merging profile from a binary for " << Header.FileName + << " into a profile for binary " << MergedHeader.FileName << '\n'; } if (MergedHeader.Id.empty()) { MergedHeader.Id = Header.Id; @@ -286,7 +285,7 @@ int main(int argc, char **argv) { sys::PrintStackTraceOnErrorSignal(argv[0]); PrettyStackTraceProgram X(argc, argv); - llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. + llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. cl::HideUnrelatedOptions(opts::MergeFdataCategory); @@ -349,19 +348,14 @@ int main(int argc, char **argv) { BinaryProfile MergedProfile; MergedProfile.Header = MergedHeader; MergedProfile.Functions.resize(MergedBFs.size()); - std::transform(MergedBFs.begin(), - MergedBFs.end(), - MergedProfile.Functions.begin(), - [] (StringMapEntry<BinaryFunctionProfile> &V) { - return V.second; - }); + std::transform( + MergedBFs.begin(), MergedBFs.end(), MergedProfile.Functions.begin(), + [](StringMapEntry<BinaryFunctionProfile> &V) { return V.second; }); // For consistency, sort functions by their IDs. std::sort(MergedProfile.Functions.begin(), MergedProfile.Functions.end(), - [] (const BinaryFunctionProfile &A, - const BinaryFunctionProfile &B) { - return A.Id < B.Id; - }); + [](const BinaryFunctionProfile &A, + const BinaryFunctionProfile &B) { return A.Id < B.Id; }); YamlOut << MergedProfile; } @@ -372,39 +366,33 @@ int main(int argc, char **argv) { if (opts::PrintFunctionList != opts::ST_NONE) { // List of function names with execution count. std::vector<std::pair<uint64_t, StringRef>> FunctionList(MergedBFs.size()); - using CountFuncType = - std::function<std::pair<uint64_t, StringRef>( - const StringMapEntry<BinaryFunctionProfile> &)>; + using CountFuncType = std::function<std::pair<uint64_t, StringRef>( + const StringMapEntry<BinaryFunctionProfile> &)>; CountFuncType ExecCountFunc = [](const StringMapEntry<BinaryFunctionProfile> &V) { - return std::make_pair(V.second.ExecCount, - StringRef(V.second.Name)); - }; + return std::make_pair(V.second.ExecCount, StringRef(V.second.Name)); + }; CountFuncType BranchCountFunc = [](const StringMapEntry<BinaryFunctionProfile> &V) { - // Return total branch count. - uint64_t BranchCount = 0; - for (const BinaryBasicBlockProfile &BI : V.second.Blocks) { - for (const SuccessorInfo &SI : BI.Successors) { - BranchCount += SI.Count; - } - } - return std::make_pair(BranchCount, - StringRef(V.second.Name)); - }; + // Return total branch count. + uint64_t BranchCount = 0; + for (const BinaryBasicBlockProfile &BI : V.second.Blocks) { + for (const SuccessorInfo &SI : BI.Successors) { + BranchCount += SI.Count; + } + } + return std::make_pair(BranchCount, StringRef(V.second.Name)); + }; CountFuncType CountFunc = (opts::PrintFunctionList == opts::ST_EXEC_COUNT) - ? ExecCountFunc - : BranchCountFunc; - std::transform(MergedBFs.begin(), - MergedBFs.end(), - FunctionList.begin(), + ? ExecCountFunc + : BranchCountFunc; + std::transform(MergedBFs.begin(), MergedBFs.end(), FunctionList.begin(), CountFunc); std::stable_sort(FunctionList.rbegin(), FunctionList.rend()); errs() << "Functions sorted by " - << (opts::PrintFunctionList == opts::ST_EXEC_COUNT - ? "execution" - : "total branch") + << (opts::PrintFunctionList == opts::ST_EXEC_COUNT ? "execution" + : "total branch") << " count:\n"; for (std::pair<uint64_t, StringRef> &FI : FunctionList) { errs() << FI.second << " : " << FI.first << '\n'; |