[llvm] [Support] Use block numbers for DomTree construction (PR #101706)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 07:25:36 PDT 2024


================
@@ -73,7 +73,11 @@ struct SemiNCAInfo {
   // Number to node mapping is 1-based. Initialize the mapping to start with
   // a dummy element.
   SmallVector<NodePtr, 64> NumToNode = {nullptr};
-  DenseMap<NodePtr, InfoRec> NodeToInfo;
+  // If blocks have numbers (e.g., BasicBlock, MachineBasicBlock), store node
+  // infos in a vector.
+  SmallVector<InfoRec, 64> NodeInfos;
+  // For blocks without numbers, store InfoRec in a map.
+  DenseMap<NodePtr, InfoRec> NodeInfoMap;
----------------
kuhar wrote:

We could use `std::conditional_t` to pick better types (or small size) depending on whether the graph has node numbers or not. For example the small size can be `0` when it does not use graph numbers.

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


More information about the llvm-commits mailing list