[llvm] [BasicBlockSections] Propose a staleness detection by checking the func cfg node num (PR #133244)

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 27 05:58:38 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff c41926013fd8b23c3d1eca51804a2de36c88433a 11a78d9204f6aa0c82b85c93207f725d5c530678 --extensions h,cpp -- llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h llvm/lib/CodeGen/BasicBlockSections.cpp llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp
index ad2e86ea16..4c237fe665 100644
--- a/llvm/lib/CodeGen/BasicBlockSections.cpp
+++ b/llvm/lib/CodeGen/BasicBlockSections.cpp
@@ -79,8 +79,8 @@
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/CodeGen/TargetInstrInfo.h"
 #include "llvm/InitializePasses.h"
-#include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/WithColor.h"
+#include "llvm/Target/TargetMachine.h"
 #include <optional>
 
 using namespace llvm;
@@ -320,13 +320,13 @@ bool BasicBlockSections::handleBBSections(MachineFunction &MF) {
             .getClusterInfoForFunction(MF.getName());
     if (!HasProfile)
       return false;
-    
+
     NodeCount = getAnalysis<BasicBlockSectionsProfileReaderWrapperPass>()
                     .getCfgNodeNumForFunction(MF.getName());
     if ((NodeCount != 0) && (NodeCount != MF.size())) {
       WithColor::warning() << "MF " << MF.getName() << ": node count mismatch "
-                        << "(profile=" << NodeCount
-                        << " actual=" << MF.size() << ")\n";
+                           << "(profile=" << NodeCount
+                           << " actual=" << MF.size() << ")\n";
       return false;
     }
 
diff --git a/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp b/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
index 06e5034522..1a41b88b9f 100644
--- a/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
+++ b/llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
@@ -72,8 +72,7 @@ BasicBlockSectionsProfileReader::getClusterInfoForFunction(
 unsigned BasicBlockSectionsProfileReader::getCfgNodeNumForFunction(
     StringRef FuncName) const {
   auto R = ProgramPathAndClusterInfo.find(getAliasName(FuncName));
-  return R != ProgramPathAndClusterInfo.end()
-             ? R->second.NodeCount : 0;
+  return R != ProgramPathAndClusterInfo.end() ? R->second.NodeCount : 0;
 }
 
 SmallVector<SmallVector<unsigned>>

``````````

</details>


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


More information about the llvm-commits mailing list