[llvm] [BOLT] CDSplit main logic part 1/2 (PR #73895)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 11:10:22 PST 2023


================
@@ -173,6 +184,260 @@ struct SplitCacheDirected final : public SplitStrategy {
   }
 
 private:
+  struct JumpInfo {
+    bool HasUncondBranch = false;
+    BinaryBasicBlock *CondSuccessor = nullptr;
+    BinaryBasicBlock *UncondSuccessor = nullptr;
+  };
+
+  struct CallInfo {
+    size_t Length;
+    size_t Count;
+  };
+
+  // Auxiliary variables used by the algorithm.
+  size_t TotalNumBlocks{0};
+  size_t OrigHotSectionSize{0};
+  DenseMap<const BinaryBasicBlock *, size_t> GlobalIndices;
+  DenseMap<const BinaryBasicBlock *, size_t> BBSizes;
+  DenseMap<const BinaryBasicBlock *, size_t> BBOffsets;
+  DenseMap<const BinaryBasicBlock *, JumpInfo> JumpInfos;
+
+  // Sizes of branch instructions used to approximate block size increase
+  // due to hot-warm splitting. Initialized to be 0. These values are updated
+  // if the architecture is X86.
+  uint8_t BRANCH_SIZE = 0;
+  uint8_t LONG_UNCOND_BRANCH_SIZE_DELTA = 0;
+  uint8_t LONG_COND_BRANCH_SIZE_DELTA = 0;
----------------
maksfb wrote:

Is there a reason for these variables to use a different naming scheme?

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


More information about the llvm-commits mailing list