[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port machine trace metrics analysis to new pass manager. (PR #108507)

Christudasan Devadasan via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Sep 23 01:42:53 PDT 2024


================
@@ -102,19 +103,22 @@ class MachineTraceMetrics : public MachineFunctionPass {
   TargetSchedModel SchedModel;
 
 public:
+  friend class MachineTraceMetricsWrapperPass;
   friend class Ensemble;
   friend class Trace;
 
   class Ensemble;
 
-  static char ID;
+  // For legacy pass.
+  MachineTraceMetrics() {
+    std::fill(std::begin(Ensembles), std::end(Ensembles), nullptr);
+  }
----------------
cdevadas wrote:

It isn't possible to move out the Ensembles pointer initialization from the constructors. Certain tests crashed while the destructor invokes clear() that tries to delete the Ensemble pointers (some garbage value). The default constructor for these tests doesn't appropriately clear the object's members. The tests that crashed don't contain any function definitions, but only some global declarations. So the run() instances won't be invoked for clearing these pointers. Also, they should point to the dynamically allocated addresses (otherwise the initial null addresses) before the destructor is invoked.


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


More information about the llvm-branch-commits mailing list