[llvm] [ctx_prof] Profile flatterner (PR #104539)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 19:07:52 PDT 2024


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 2adc012c34b269f80a735c1ec2011f3a98175cbc 985a4ee2a6a9763086e7494c97f13f8ae0403c1e --extensions h,cpp -- llvm/include/llvm/Analysis/CtxProfAnalysis.h llvm/lib/Analysis/CtxProfAnalysis.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp
index e0e8c4d4b1..a7149abcfd 100644
--- a/llvm/lib/Analysis/CtxProfAnalysis.cpp
+++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp
@@ -195,23 +195,24 @@ PreservedAnalyses CtxProfAnalysisPrinterPass::run(Module &M,
   return PreservedAnalyses::all();
 }
 
-static void preorderVisit(const PGOCtxProfContext::CallTargetMapTy &Profiles,
-                   function_ref<void(const PGOCtxProfContext &)> Visitor) {
-  std::function<void(const PGOCtxProfContext &)>
-      Traverser = [&](const auto &Ctx) {
+static void
+preorderVisit(const PGOCtxProfContext::CallTargetMapTy &Profiles,
+              function_ref<void(const PGOCtxProfContext &)> Visitor) {
+  std::function<void(const PGOCtxProfContext &)> Traverser =
+      [&](const auto &Ctx) {
         Visitor(Ctx);
         for (const auto &[_, SubCtxSet] : Ctx.callsites())
           for (const auto &[__, Subctx] : SubCtxSet)
             Traverser(Subctx);
       };
-  for (const auto& [_, P] : Profiles)
+  for (const auto &[_, P] : Profiles)
     Traverser(P);
 }
 
 const CtxProfFlatProfile PGOContextualProfile::flatten() const {
   assert(Profiles.has_value());
   CtxProfFlatProfile Flat;
-  preorderVisit(*Profiles, [&](const PGOCtxProfContext& Ctx) {
+  preorderVisit(*Profiles, [&](const PGOCtxProfContext &Ctx) {
     auto [It, Ins] = Flat.insert({Ctx.guid(), {}});
     if (Ins) {
       llvm::append_range(It->second, Ctx.counters());

``````````

</details>


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


More information about the llvm-commits mailing list