[llvm] CodeGen/NewPM: Initialize MMI in NewPM path (PR #99754)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 20 05:17:31 PDT 2024


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/99754

This should have been in c2019a37bdb1375e9f72b2549361cc50ea7729db,
but it breaks with:

Assertion failed: (AnalysisPasses.count(PassT::ID()) && "This analysis pass was not registered prior to being queried"), function getResult, file PassManager.h, line 407.

>From 34bd26317a2472ba7c2d48548f8a0e66584ddd38 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Sat, 20 Jul 2024 15:23:21 +0400
Subject: [PATCH] CodeGen/NewPM: Initialize MMI in NewPM path

This should have been in c2019a37bdb1375e9f72b2549361cc50ea7729db,
but it breaks with:

Assertion failed: (AnalysisPasses.count(PassT::ID()) && "This analysis pass was not registered prior to being queried"), function getResult, file PassManager.h, line 407.
---
 llvm/include/llvm/Passes/MachinePassRegistry.def   | 1 +
 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def
index 03f0782de6fed..e702721c299a8 100644
--- a/llvm/include/llvm/Passes/MachinePassRegistry.def
+++ b/llvm/include/llvm/Passes/MachinePassRegistry.def
@@ -17,6 +17,7 @@
 #define MODULE_ANALYSIS(NAME, CREATE_PASS)
 #endif
 MODULE_ANALYSIS("collector-metadata", CollectorMetadataAnalysis())
+MODULE_ANALYSIS("machine-module-info", MachineModuleAnalysis())
 MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
 #undef MODULE_ANALYSIS
 
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 2670ff488fbed..478e544fd4bc0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -509,6 +509,8 @@ void SelectionDAGISel::initializeAnalysisResults(
     FnVarLocs = &FAM.getResult<DebugAssignmentTrackingAnalysis>(Fn);
 
   auto *UA = FAM.getCachedResult<UniformityInfoAnalysis>(Fn);
+  MMI = &MFAM.getResult<MachineModuleAnalysis>(*MF).getMMI();
+
   CurDAG->init(*MF, *ORE, MFAM, LibInfo, UA, PSI, BFI, *MMI, FnVarLocs);
 
   // Now get the optional analyzes if we want to.



More information about the llvm-commits mailing list