[llvm] [CodeGen][StaticDataPartitioning]Place local-linkage global variables in hot or unlikely prefixed sections based on profile information (PR #125756)

Pengying Xu via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 22:33:23 PST 2025


================
@@ -92,63 +121,131 @@ bool StaticDataSplitter::splitJumpTablesWithProfiles(
   for (const auto &MBB : MF) {
     for (const MachineInstr &I : MBB) {
       for (const MachineOperand &Op : I.operands()) {
-        if (!Op.isJTI())
-          continue;
-        const int JTI = Op.getIndex();
-        // This is not a source block of jump table.
-        if (JTI == -1)
+        std::optional<uint64_t> Count = std::nullopt;
+        if (!Op.isJTI() && !Op.isGlobal())
           continue;
 
-        auto Hotness = MachineFunctionDataHotness::Hot;
+        Count = MBFI->getBlockProfileCount(&MBB);
----------------
Colibrow wrote:

```suggestion
	if (!Op.isJTI() && !Op.isGlobal())
          continue;

        std::optional<uint64_t> Count = MBFI->getBlockProfileCount(&MBB);
```
is that OK?

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


More information about the llvm-commits mailing list