[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port SpillPlacement analysis to NPM (PR #116618)

Akshat Oke via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 18 21:28:44 PST 2024


================
@@ -38,13 +39,21 @@ class BitVector;
 class EdgeBundles;
 class MachineBlockFrequencyInfo;
 class MachineFunction;
+class SpillPlacementWrapperLegacy;
+class SpillPlacementAnalysis;
+
+class SpillPlacement {
+  friend class SpillPlacementWrapperLegacy;
+  friend class SpillPlacementAnalysis;
 
-class SpillPlacement : public MachineFunctionPass {
   struct Node;
+
   const MachineFunction *MF = nullptr;
   const EdgeBundles *bundles = nullptr;
   const MachineBlockFrequencyInfo *MBFI = nullptr;
-  Node *nodes = nullptr;
+
+  static void arrayDeleter(Node *N);
+  std::unique_ptr<Node, decltype(&arrayDeleter)> nodes;
----------------
optimisan wrote:

The definition of `Node` is not available here, so the default deleter fails to compile sizeof(Node) for this incomplete type. To hack around it I put the definition of `arrayDeleter` in the implementation where struct Node is defined.

But changing to `unique_ptr<Node[], theDeleter>` facilitates removal of `.get()` calls 

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


More information about the llvm-branch-commits mailing list