[llvm] BlockFrequencyInfo: Add PrintBlockFreq helper (PR #67512)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 17:58:16 PDT 2023


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 58f7543361a475f0f8e309a2b5f38a3daa405549 033338ece193dca564d9d9e9513cb8637f320807 -- llvm/include/llvm/Analysis/BlockFrequencyInfo.h llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h llvm/include/llvm/CodeGen/MBFIWrapper.h llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h llvm/lib/Analysis/BlockFrequencyInfo.cpp llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp llvm/lib/CodeGen/MBFIWrapper.cpp llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp llvm/lib/CodeGen/MachineBlockPlacement.cpp llvm/lib/CodeGen/RegAllocGreedy.cpp llvm/lib/CodeGen/ShrinkWrap.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/include/llvm/CodeGen/MBFIWrapper.h b/llvm/include/llvm/CodeGen/MBFIWrapper.h
index 1b00deb6fac7..df87888a7f15 100644
--- a/llvm/include/llvm/CodeGen/MBFIWrapper.h
+++ b/llvm/include/llvm/CodeGen/MBFIWrapper.h
@@ -36,7 +36,7 @@ class MBFIWrapper {
   uint64_t getEntryFreq() const;
   const MachineBlockFrequencyInfo &getMBFI() const { return MBFI; }
 
- private:
+private:
   const MachineBlockFrequencyInfo &MBFI;
   DenseMap<const MachineBasicBlock *, BlockFrequency> MergedBBFreq;
 };
diff --git a/llvm/lib/Analysis/BlockFrequencyInfo.cpp b/llvm/lib/Analysis/BlockFrequencyInfo.cpp
index 6686e4c7f2d9..ac25ec846628 100644
--- a/llvm/lib/Analysis/BlockFrequencyInfo.cpp
+++ b/llvm/lib/Analysis/BlockFrequencyInfo.cpp
@@ -79,12 +79,12 @@ cl::opt<PGOViewCountsType> PGOViewCounts(
                clEnumValN(PGOVCT_Text, "text", "show in text.")));
 
 static cl::opt<bool> PrintBFI("print-bfi", cl::init(false), cl::Hidden,
-    cl::desc("Print the block frequency info."));
+                              cl::desc("Print the block frequency info."));
 
 cl::opt<std::string>
     PrintBFIFuncName("print-bfi-func-name", cl::Hidden,
-    cl::desc("The option to specify the name of the function "
-             "whose block frequency info is printed."));
+                     cl::desc("The option to specify the name of the function "
+                              "whose block frequency info is printed."));
 } // namespace llvm
 
 namespace llvm {
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index f38b6d7a579e..ab4c9dbcf6bb 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -2240,8 +2240,9 @@ MachineBlockPlacement::findBestLoopExit(const MachineLoop &L,
       }
 
       BlockFrequency ExitEdgeFreq = MBFI->getBlockFreq(MBB) * SuccProb;
-      LLVM_DEBUG(dbgs() << "    exiting: " << getBlockName(MBB) << " -> "
-                        << getBlockName(Succ) << " [L:" << SuccLoopDepth << "] ("
+      LLVM_DEBUG(
+          dbgs() << "    exiting: " << getBlockName(MBB) << " -> "
+                 << getBlockName(Succ) << " [L:" << SuccLoopDepth << "] ("
                  << PrintBlockFreq(MBFI->getMBFI(), ExitEdgeFreq) << ")\n");
       // Note that we bias this toward an existing layout successor to retain
       // incoming order in the absence of better information. The exit must have

``````````

</details>


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


More information about the llvm-commits mailing list