[llvm] [NewPM][Instrumentation] Support `MachineOptimizationRemarkEmitter` (PR #90563)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 14:15:16 PDT 2024


================
@@ -1329,6 +1342,51 @@ struct PreservedModuleHashAnalysis
 
 AnalysisKey PreservedModuleHashAnalysis::Key;
 
+struct MachineInstrCounterAnalysis
+    : public AnalysisInfoMixin<MachineInstrCounterAnalysis> {
+  static AnalysisKey Key;
+
+  struct Result {
+    bool invalidate(MachineFunction &MF, const PreservedAnalyses &,
+                    MachineFunctionAnalysisManager::Invalidator &) {
+      return false;
----------------
aeubanks wrote:

I'm still not understanding how the current code works with multiple passes, it's still not getting invalidated.

But is it possible to simplify this by just having the instrumentation record the instruction count before as pass and compare that after the pass? and for a module pass, we can record every MachineFunction's count with a map. then there's no need to involve analyses/analysis managers

https://github.com/llvm/llvm-project/pull/90563


More information about the llvm-commits mailing list