diff options
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/dsymutil/MachOUtils.cpp | 2 | ||||
-rw-r--r-- | llvm/tools/opt/NewPMDriver.cpp | 8 | ||||
-rw-r--r-- | llvm/tools/opt/NewPMDriver.h | 2 | ||||
-rw-r--r-- | llvm/tools/opt/optdriver.cpp | 12 |
4 files changed, 19 insertions, 5 deletions
diff --git a/llvm/tools/dsymutil/MachOUtils.cpp b/llvm/tools/dsymutil/MachOUtils.cpp index be1934f..362a999 100644 --- a/llvm/tools/dsymutil/MachOUtils.cpp +++ b/llvm/tools/dsymutil/MachOUtils.cpp @@ -331,7 +331,7 @@ static bool createDwarfSegment(const MCAssembler& Asm,uint64_t VMAddr, uint64_t /* InitProt =*/3); for (unsigned int i = 0, n = Writer.getSectionOrder().size(); i != n; ++i) { - MCSection *Sec = Writer.getSectionOrder()[i]; + auto *Sec = static_cast<MCSectionMachO *>(Writer.getSectionOrder()[i]); if (!Asm.getSectionFileSize(*Sec)) continue; diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp index 7d168a6..b9b8929 100644 --- a/llvm/tools/opt/NewPMDriver.cpp +++ b/llvm/tools/opt/NewPMDriver.cpp @@ -40,6 +40,7 @@ #include "llvm/Transforms/Instrumentation/AddressSanitizer.h" #include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Transforms/Utils/Debugify.h" +#include "llvm/Transforms/Utils/ProfileVerify.h" using namespace llvm; using namespace opt_tool; @@ -356,7 +357,7 @@ bool llvm::runPassPipeline( OutputKind OK, VerifierKind VK, bool ShouldPreserveAssemblyUseListOrder, bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex, bool EmitModuleHash, bool EnableDebugify, bool VerifyDIPreserve, - bool UnifiedLTO) { + bool EnableProfcheck, bool UnifiedLTO) { auto FS = vfs::getRealFileSystem(); std::optional<PGOOptions> P; switch (PGOKindFlag) { @@ -487,7 +488,8 @@ bool llvm::runPassPipeline( if (VerifyDIPreserve) MPM.addPass(NewPMDebugifyPass(DebugifyMode::OriginalDebugInfo, "", &DebugInfoBeforePass)); - + if (EnableProfcheck) + MPM.addPass(createModuleToFunctionPassAdaptor(ProfileInjectorPass())); // Add passes according to the -passes options. if (!PassPipeline.empty()) { if (auto Err = PB.parsePassPipeline(MPM, PassPipeline)) { @@ -504,6 +506,8 @@ bool llvm::runPassPipeline( MPM.addPass(NewPMCheckDebugifyPass( false, "", nullptr, DebugifyMode::OriginalDebugInfo, &DebugInfoBeforePass, VerifyDIPreserveExport)); + if (EnableProfcheck) + MPM.addPass(createModuleToFunctionPassAdaptor(ProfileVerifierPass())); // Add any relevant output pass at the end of the pipeline. switch (OK) { diff --git a/llvm/tools/opt/NewPMDriver.h b/llvm/tools/opt/NewPMDriver.h index 2daae57..6c21d6c 100644 --- a/llvm/tools/opt/NewPMDriver.h +++ b/llvm/tools/opt/NewPMDriver.h @@ -75,7 +75,7 @@ bool runPassPipeline( bool ShouldPreserveAssemblyUseListOrder, bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex, bool EmitModuleHash, bool EnableDebugify, bool VerifyDIPreserve, - bool UnifiedLTO = false); + bool EnableProfcheck, bool UnifiedLTO = false); } // namespace llvm #endif diff --git a/llvm/tools/opt/optdriver.cpp b/llvm/tools/opt/optdriver.cpp index 892b63b..4a3b058 100644 --- a/llvm/tools/opt/optdriver.cpp +++ b/llvm/tools/opt/optdriver.cpp @@ -217,6 +217,15 @@ static cl::opt<bool> VerifyDebugInfoPreserve( cl::desc("Start the pipeline with collecting and end it with checking of " "debug info preservation.")); +static cl::opt<bool> EnableProfileVerification( + "enable-profcheck", +#if defined(LLVM_ENABLE_PROFCHECK) + cl::init(true), +#else + cl::init(false), +#endif + cl::desc("Start the pipeline with prof-inject and end it with prof-check")); + static cl::opt<std::string> ClDataLayout("data-layout", cl::desc("data layout string to use"), cl::value_desc("layout-string"), @@ -746,7 +755,8 @@ extern "C" int optMain( RemarksFile.get(), Pipeline, PluginList, PassBuilderCallbacks, OK, VK, PreserveAssemblyUseListOrder, PreserveBitcodeUseListOrder, EmitSummaryIndex, EmitModuleHash, - EnableDebugify, VerifyDebugInfoPreserve, UnifiedLTO) + EnableDebugify, VerifyDebugInfoPreserve, + EnableProfileVerification, UnifiedLTO) ? 0 : 1; } |