diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-02-05 20:07:43 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2022-05-14 11:44:47 +0000 |
commit | 1fd87a682ad7442327078e1eeb63edc4258f9815 (patch) | |
tree | 83b42223e987ef7df2e1036937bc1bb627fa2779 /contrib/llvm-project/llvm/tools | |
parent | 04eeddc0aa8e0a417a16eaf9d7d095207f4a8623 (diff) | |
parent | ecbca9f5fb7d7613d2b94982c4825eb0d33d6842 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/tools')
9 files changed, 41 insertions, 16 deletions
diff --git a/contrib/llvm-project/llvm/tools/llvm-ar/llvm-ar.cpp b/contrib/llvm-project/llvm/tools/llvm-ar/llvm-ar.cpp index f7b29b884027..8842162f5216 100644 --- a/contrib/llvm-project/llvm/tools/llvm-ar/llvm-ar.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-ar/llvm-ar.cpp @@ -90,6 +90,7 @@ OPTIONS: --rsp-quoting - quoting style for response files =posix - posix =windows - windows + --thin - create a thin archive --version - print the version and exit @<file> - read options from <file> @@ -118,7 +119,7 @@ MODIFIERS: [P] - use full names when matching (implied for thin archives) [s] - create an archive index (cf. ranlib) [S] - do not build a symbol table - [T] - create a thin archive + [T] - deprecated, use --thin instead [u] - update only [files] newer than archive contents [U] - use actual timestamps and uids/gids [v] - be verbose about actions taken @@ -390,8 +391,6 @@ static ArchiveOperation parseCommandLine() { break; case 'T': Thin = true; - // Thin archives store path names, so P should be forced. - CompareFullPath = true; break; case 'L': AddLibrary = true; @@ -407,6 +406,10 @@ static ArchiveOperation parseCommandLine() { } } + // Thin archives store path names, so P should be forced. + if (Thin) + CompareFullPath = true; + // At this point, the next thing on the command line must be // the archive name. getArchive(); @@ -965,6 +968,8 @@ static void createSymbolTable(object::Archive *OldArchive) { if (OldArchive->hasSymbolTable()) return; + if (OldArchive->isThin()) + Thin = true; performWriteOperation(CreateSymTab, OldArchive, nullptr, nullptr); } @@ -1202,6 +1207,11 @@ static int ar_main(int argc, char **argv) { continue; } + if (strcmp(*ArgIt, "--thin") == 0) { + Thin = true; + continue; + } + Match = matchFlagWithArg("format", ArgIt, Argv); if (Match) { FormatType = StringSwitch<Format>(Match) diff --git a/contrib/llvm-project/llvm/tools/llvm-as/llvm-as.cpp b/contrib/llvm-project/llvm/tools/llvm-as/llvm-as.cpp index 307a7f9b7999..11dad0d9c369 100644 --- a/contrib/llvm-project/llvm/tools/llvm-as/llvm-as.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-as/llvm-as.cpp @@ -106,7 +106,7 @@ static void WriteOutputFile(const Module *M, const ModuleSummaryIndex *Index) { else // Otherwise, with an empty Module but non-empty Index, we write a // combined index. - WriteIndexToFile(*IndexToWrite, Out->os()); + writeIndexToFile(*IndexToWrite, Out->os()); } // Declare success. diff --git a/contrib/llvm-project/llvm/tools/llvm-extract/llvm-extract.cpp b/contrib/llvm-project/llvm/tools/llvm-extract/llvm-extract.cpp index cb1c4116ff19..3cdef529504e 100644 --- a/contrib/llvm-project/llvm/tools/llvm-extract/llvm-extract.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-extract/llvm-extract.cpp @@ -21,6 +21,7 @@ #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/Module.h" #include "llvm/IRReader/IRReader.h" +#include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Error.h" #include "llvm/Support/FileSystem.h" diff --git a/contrib/llvm-project/llvm/tools/llvm-lto/llvm-lto.cpp b/contrib/llvm-project/llvm/tools/llvm-lto/llvm-lto.cpp index d78c4dff7db4..8fc3a5d68500 100644 --- a/contrib/llvm-project/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-lto/llvm-lto.cpp @@ -497,7 +497,7 @@ static void createCombinedModuleSummaryIndex() { raw_fd_ostream OS(OutputFilename + ".thinlto.bc", EC, sys::fs::OpenFlags::OF_None); error(EC, "error opening the file '" + OutputFilename + ".thinlto.bc'"); - WriteIndexToFile(CombinedIndex, OS); + writeIndexToFile(CombinedIndex, OS); OS.close(); } @@ -660,7 +660,7 @@ private: std::error_code EC; raw_fd_ostream OS(OutputFilename, EC, sys::fs::OpenFlags::OF_None); error(EC, "error opening the file '" + OutputFilename + "'"); - WriteIndexToFile(*CombinedIndex, OS); + writeIndexToFile(*CombinedIndex, OS); } /// Load the combined index from disk, then compute and generate @@ -698,7 +698,7 @@ private: std::error_code EC; raw_fd_ostream OS(OutputName, EC, sys::fs::OpenFlags::OF_None); error(EC, "error opening the file '" + OutputName + "'"); - WriteIndexToFile(*Index, OS, &ModuleToSummariesForIndex); + writeIndexToFile(*Index, OS, &ModuleToSummariesForIndex); } } diff --git a/contrib/llvm-project/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp b/contrib/llvm-project/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp index 3cac77411845..6b731abd9ed9 100644 --- a/contrib/llvm-project/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp @@ -417,6 +417,7 @@ Error MachOLayoutBuilder::layoutTail(uint64_t Offset) { case MachO::LC_SUB_UMBRELLA: case MachO::LC_SUB_CLIENT: case MachO::LC_SUB_LIBRARY: + case MachO::LC_LINKER_OPTION: // Nothing to update. break; default: diff --git a/contrib/llvm-project/llvm/tools/llvm-profdata/llvm-profdata.cpp b/contrib/llvm-project/llvm/tools/llvm-profdata/llvm-profdata.cpp index 5e58c1365d80..6000460d3c23 100644 --- a/contrib/llvm-project/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -255,9 +255,7 @@ static void loadInput(const WeightedFile &Input, SymbolRemapper *Remapper, } auto Reader = std::move(ReaderOrErr.get()); - bool IsIRProfile = Reader->isIRLevelProfile(); - bool HasCSIRProfile = Reader->hasCSIRLevelProfile(); - if (Error E = WC->Writer.setIsIRLevelProfile(IsIRProfile, HasCSIRProfile)) { + if (Error E = WC->Writer.mergeProfileKind(Reader->getProfileKind())) { consumeError(std::move(E)); WC->Errors.emplace_back( make_error<StringError>( @@ -266,7 +264,6 @@ static void loadInput(const WeightedFile &Input, SymbolRemapper *Remapper, Filename); return; } - WC->Writer.setInstrEntryBBEnabled(Reader->instrEntryBBEnabled()); for (auto &I : *Reader) { if (Remapper) @@ -2095,7 +2092,8 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts, bool ShowAllFunctions, bool ShowCS, uint64_t ValueCutoff, bool OnlyListBelow, const std::string &ShowFunction, bool TextFormat, - bool ShowBinaryIds, raw_fd_ostream &OS) { + bool ShowBinaryIds, bool ShowCovered, + raw_fd_ostream &OS) { auto ReaderOrErr = InstrProfReader::create(Filename); std::vector<uint32_t> Cutoffs = std::move(DetailedSummaryCutoffs); if (ShowDetailedSummary && Cutoffs.empty()) { @@ -2152,6 +2150,13 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts, assert(Func.Counts.size() > 0 && "function missing entry counter"); Builder.addRecord(Func); + if (ShowCovered) { + if (std::any_of(Func.Counts.begin(), Func.Counts.end(), + [](uint64_t C) { return C; })) + OS << Func.Name << "\n"; + continue; + } + uint64_t FuncMax = 0; uint64_t FuncSum = 0; for (size_t I = 0, E = Func.Counts.size(); I < E; ++I) { @@ -2228,7 +2233,7 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts, if (Reader->hasError()) exitWithError(Reader->getError(), Filename); - if (TextFormat) + if (TextFormat || ShowCovered) return 0; std::unique_ptr<ProfileSummary> PS(Builder.getSummary()); bool IsIR = Reader->isIRLevelProfile(); @@ -2579,6 +2584,9 @@ static int show_main(int argc, const char *argv[]) { "debug-info", cl::init(""), cl::desc("Read and extract profile metadata from debug info and show " "the functions it found.")); + cl::opt<bool> ShowCovered( + "covered", cl::init(false), + cl::desc("Show only the functions that have been executed.")); cl::ParseCommandLineOptions(argc, argv, "LLVM profile data summary\n"); @@ -2610,7 +2618,7 @@ static int show_main(int argc, const char *argv[]) { Filename, ShowCounts, TopNFunctions, ShowIndirectCallTargets, ShowMemOPSizes, ShowDetailedSummary, DetailedSummaryCutoffs, ShowAllFunctions, ShowCS, ValueCutoff, OnlyListBelow, ShowFunction, - TextFormat, ShowBinaryIds, OS); + TextFormat, ShowBinaryIds, ShowCovered, OS); if (ProfileKind == sample) return showSampleProfile(Filename, ShowCounts, TopNFunctions, ShowAllFunctions, ShowDetailedSummary, diff --git a/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp b/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp index cfb618117d2b..04a67225401f 100644 --- a/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -6393,6 +6393,7 @@ template <class ELFT> void LLVMELFDumper<ELFT>::printFileHeaders() { unsigned(ELF::EF_AMDGPU_MACH)); break; case ELF::ELFABIVERSION_AMDGPU_HSA_V4: + case ELF::ELFABIVERSION_AMDGPU_HSA_V5: W.printFlags("Flags", E.e_flags, makeArrayRef(ElfHeaderAMDGPUFlagsABIVersion4), unsigned(ELF::EF_AMDGPU_MACH), diff --git a/contrib/llvm-project/llvm/tools/llvm-readobj/WasmDumper.cpp b/contrib/llvm-project/llvm/tools/llvm-readobj/WasmDumper.cpp index d76332d1ba36..b4d726016437 100644 --- a/contrib/llvm-project/llvm/tools/llvm-readobj/WasmDumper.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-readobj/WasmDumper.cpp @@ -183,7 +183,10 @@ void WasmDumper::printSectionHeaders() { W.printNumber("Offset", Seg.Offset.Value.Int32); else if (Seg.Offset.Opcode == wasm::WASM_OPCODE_I64_CONST) W.printNumber("Offset", Seg.Offset.Value.Int64); - else + else if (Seg.Offset.Opcode == wasm::WASM_OPCODE_GLOBAL_GET) { + ListScope Group(W, "Offset"); + W.printNumber("Global", Seg.Offset.Value.Global); + } else llvm_unreachable("unknown init expr opcode"); } break; diff --git a/contrib/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp b/contrib/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp index 941b529da9b2..9135d60fdf92 100644 --- a/contrib/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp @@ -34,14 +34,15 @@ #include "llvm/IR/Type.h" #include "llvm/IR/Value.h" #include "llvm/IR/Verifier.h" +#include "llvm/Pass.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/ToolOutputFile.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Support/WithColor.h" +#include "llvm/Support/raw_ostream.h" #include <algorithm> #include <cassert> #include <cstddef> |