[llvm] Use the Propeller CFG profile in the PGO analysis map if it is available. (PR #163252)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 22:23:18 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 origin/main HEAD --extensions h,cpp -- llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h llvm/include/llvm/Object/ELFTypes.h llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/include/llvm/Object/ELFTypes.h b/llvm/include/llvm/Object/ELFTypes.h
index e6d455216..c35d5066f 100644
--- a/llvm/include/llvm/Object/ELFTypes.h
+++ b/llvm/include/llvm/Object/ELFTypes.h
@@ -840,7 +840,9 @@ struct BBAddrMap {
       return FuncEntryCount || BBFreq || BrProb || PropellerCFG;
     }
 
-    bool hasPGOAnalysisBBData() const { return BBFreq || BrProb || PropellerCFG; }
+    bool hasPGOAnalysisBBData() const {
+      return BBFreq || BrProb || PropellerCFG;
+    }
 
     // Encodes to minimum bit width representation.
     uint8_t encode() const {
@@ -871,10 +873,12 @@ struct BBAddrMap {
 
     bool operator==(const Features &Other) const {
       return std::tie(FuncEntryCount, BBFreq, BrProb, MultiBBRange,
-                      OmitBBEntries, CallsiteEndOffsets, BBHash, PropellerCFG) ==
+                      OmitBBEntries, CallsiteEndOffsets, BBHash,
+                      PropellerCFG) ==
              std::tie(Other.FuncEntryCount, Other.BBFreq, Other.BrProb,
                       Other.MultiBBRange, Other.OmitBBEntries,
-                      Other.CallsiteEndOffsets, Other.BBHash, Other.PropellerCFG);
+                      Other.CallsiteEndOffsets, Other.BBHash,
+                      Other.PropellerCFG);
     }
   };
 
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 4fefed2f1..1cbf36dbf 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1433,9 +1433,8 @@ getBBAddrMapFeature(const MachineFunction &MF, int NumMBBSectionRanges,
       (!NoFeatures && PgoAnalysisMapFeatures.isSet(PGOMapFeaturesEnum::BrProb));
   bool PropellerCFGEnabled =
       FuncCFGProfile &&
-      (AllFeatures ||
-       (!NoFeatures &&
-        PgoAnalysisMapFeatures.isSet(PGOMapFeaturesEnum::PropellerCFG)));
+      (AllFeatures || (!NoFeatures && PgoAnalysisMapFeatures.isSet(
+                                          PGOMapFeaturesEnum::PropellerCFG)));
 
   if ((BBFreqEnabled || BrProbEnabled) && BBAddrMapSkipEmitBBEntries) {
     MF.getFunction().getContext().emitError(
@@ -1474,8 +1473,8 @@ void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) {
   uint8_t BBAddrMapVersion = OutStreamer->getContext().getBBAddrMapVersion();
   OutStreamer->emitInt8(BBAddrMapVersion);
   OutStreamer->AddComment("feature");
-  auto Features =
-      getBBAddrMapFeature(MF, MBBSectionRanges.size(), HasCalls, FuncCFGProfile);
+  auto Features = getBBAddrMapFeature(MF, MBBSectionRanges.size(), HasCalls,
+                                      FuncCFGProfile);
   OutStreamer->emitInt8(Features.encode());
   // Emit BB Information for each basic block in the function.
   if (Features.MultiBBRange) {

``````````

</details>


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


More information about the llvm-commits mailing list