[llvm-branch-commits] [llvm] [ctx_prof] Add Inlining support (PR #106154)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 26 15:43:41 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 44201f1b7d371f156a8ae02b329f2321cad503d2 eda80fe012239f907df3ee3c4d6d94c93d9d4df2 --extensions h,cpp -- llvm/unittests/Transforms/Utils/InlineFunctionTest.cpp llvm/include/llvm/Analysis/CtxProfAnalysis.h llvm/include/llvm/IR/IntrinsicInst.h llvm/include/llvm/ProfileData/PGOCtxProfReader.h llvm/include/llvm/Transforms/Utils/Cloning.h llvm/lib/Analysis/CtxProfAnalysis.cpp llvm/lib/Transforms/IPO/ModuleInliner.cpp llvm/lib/Transforms/Utils/InlineFunction.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/include/llvm/Analysis/CtxProfAnalysis.h b/llvm/include/llvm/Analysis/CtxProfAnalysis.h
index f630dceb8a..14808f24d0 100644
--- a/llvm/include/llvm/Analysis/CtxProfAnalysis.h
+++ b/llvm/include/llvm/Analysis/CtxProfAnalysis.h
@@ -62,7 +62,7 @@ public:
   bool isFunctionKnown(const Function &F) const {
     return getDefinedFunctionGUID(F) != 0;
   }
-  
+
   uint32_t getNrCounters(const Function &F) const {
     assert(isFunctionKnown(F));
     return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCounterIndex;
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index 2ebcee422e..fc8d1b3d19 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -1516,9 +1516,7 @@ public:
     return const_cast<Value *>(getArgOperand(0))->stripPointerCasts();
   }
 
-  void setNameValue(Value *V) {
-    setArgOperand(0, V);
-  }
+  void setNameValue(Value *V) { setArgOperand(0, V); }
 
   // The hash of the CFG for the instrumented function.
   ConstantInt *getHash() const {
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 73b59c52c9..ac7a403096 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -2145,7 +2145,7 @@ remapIndices(Function &Caller, BasicBlock *StartBB,
     return true;
   };
 
-  auto RewriteCallsiteInsIfNeeded = [&](InstrProfCallsite &Ins)-> bool {
+  auto RewriteCallsiteInsIfNeeded = [&](InstrProfCallsite &Ins) -> bool {
     if (Ins.getNameValue() == &Caller)
       return false;
     const auto OldID = static_cast<uint32_t>(Ins.getIndex()->getZExtValue());
@@ -2158,8 +2158,8 @@ remapIndices(Function &Caller, BasicBlock *StartBB,
     return true;
   };
 
-  std::deque<BasicBlock*> Worklist;
-  DenseSet<const BasicBlock*> Seen;
+  std::deque<BasicBlock *> Worklist;
+  DenseSet<const BasicBlock *> Seen;
   // We will traverse the BBs starting from the callsite BB. The callsite BB
   // will have at least a BB ID - maybe its own, and in any case the one coming
   // from the cloned function's entry BB. The other BBs we'll start seeing from
diff --git a/llvm/unittests/Transforms/Utils/InlineFunctionTest.cpp b/llvm/unittests/Transforms/Utils/InlineFunctionTest.cpp
index 930a7c76e3..a5fc60ae23 100644
--- a/llvm/unittests/Transforms/Utils/InlineFunctionTest.cpp
+++ b/llvm/unittests/Transforms/Utils/InlineFunctionTest.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Transforms/Utils/Cloning.h"
 #include "llvm/Analysis/CtxProfAnalysis.h"
 #include "llvm/AsmParser/Parser.h"
 #include "llvm/IR/IRBuilder.h"
@@ -21,6 +20,7 @@
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Testing/Support/SupportHelpers.h"
+#include "llvm/Transforms/Utils/Cloning.h"
 #include "gtest/gtest.h"
 
 using namespace llvm;

``````````

</details>


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


More information about the llvm-branch-commits mailing list