about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAleksei Romanov <aleksei.romanov@yadro.com>2024-09-25 22:44:54 +0300
committerAleksei Romanov <aleksei.romanov@yadro.com>2024-09-25 22:57:32 +0300
commitafb7eef79aa6bfaa9249fe2a0dc7033a44eff063 (patch)
tree3cad3a20cf0809ac7f6292bacb6147f6ad0cc10c
parentb5117538e934f81e39eb9c326fdcc6574d144cb7 (diff)
downloadrust-afb7eef79aa6bfaa9249fe2a0dc7033a44eff063.tar.gz
rust-afb7eef79aa6bfaa9249fe2a0dc7033a44eff063.zip
Pass Module Analysis Manager to Standard Instrumentations
-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;