about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-09-27 00:43:33 +0200
committerGitHub <noreply@github.com>2024-09-27 00:43:33 +0200
commitc9478ef311a69357a3ea450d5592be2ae5ca6e7d (patch)
tree6a9ff0ccafff0324b4348b9e4735b167d22420a8
parente65054633c64e82a0f88fded06e81bb5b8678275 (diff)
parentafb7eef79aa6bfaa9249fe2a0dc7033a44eff063 (diff)
downloadrust-c9478ef311a69357a3ea450d5592be2ae5ca6e7d.tar.gz
rust-c9478ef311a69357a3ea450d5592be2ae5ca6e7d.zip
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.
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index 165fb7aa6c3..8f0b1b81276 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -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;