Rollup merge of #130850 - saveasguy:pass-mam-to-standrd-instrumentations, r=nikic

Pass Module Analysis Manager to Standard Instrumentations

This PR introduces changes related to llvm::PassInstrumentationCallbacks. Now, we pass Module Analysis Manager to StandardInstrumentations::registerCallbacks, so it can take advantage of such instrumentations as IR verifier or preserved CFG checker. So basically this is NFC PR.
This commit is contained in:
Guillaume Gomez 2024-09-27 00:43:33 +02:00 committed by GitHub
commit c9478ef311
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -732,12 +732,7 @@ extern "C" LLVMRustResult LLVMRustOptimize(
PTO.SLPVectorization = SLPVectorize;
PTO.MergeFunctions = MergeFunctions;
// FIXME: We may want to expose this as an option.
bool DebugPassManager = false;
PassInstrumentationCallbacks PIC;
StandardInstrumentations SI(TheModule->getContext(), DebugPassManager);
SI.registerCallbacks(PIC);
if (LlvmSelfProfiler) {
LLVMSelfProfileInitializeCallbacks(PIC, LlvmSelfProfiler,
@ -784,6 +779,12 @@ extern "C" LLVMRustResult LLVMRustOptimize(
CGSCCAnalysisManager CGAM;
ModuleAnalysisManager MAM;
// FIXME: We may want to expose this as an option.
bool DebugPassManager = false;
StandardInstrumentations SI(TheModule->getContext(), DebugPassManager);
SI.registerCallbacks(PIC, &MAM);
if (LLVMPluginsLen) {
auto PluginsStr = StringRef(LLVMPlugins, LLVMPluginsLen);
SmallVector<StringRef> Plugins;