[llvm] Add setBranchWeigths convenience function (PR #72446)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 14:36:08 PST 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 eaff083035c86e32bd220fef5a2fab47117b70c1 a32bc7cdbe7b4f7bb6d744bccae3014d4f148563 -- llvm/include/llvm/IR/ProfDataUtils.h llvm/lib/IR/ProfDataUtils.cpp llvm/lib/Transforms/IPO/SampleProfile.cpp llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp llvm/lib/Transforms/Scalar/JumpThreading.cpp llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp llvm/lib/Transforms/Utils/Local.cpp llvm/lib/Transforms/Utils/LoopPeel.cpp llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp
index 7d93dca8a1..29536b0b09 100644
--- a/llvm/lib/IR/ProfDataUtils.cpp
+++ b/llvm/lib/IR/ProfDataUtils.cpp
@@ -17,8 +17,8 @@
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/LLVMContext.h"
-#include "llvm/IR/Metadata.h"
 #include "llvm/IR/MDBuilder.h"
+#include "llvm/IR/Metadata.h"
 #include "llvm/Support/BranchProbability.h"
 #include "llvm/Support/CommandLine.h"
 
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index 954efeaf88..ae155ac082 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -353,14 +353,14 @@ static void updateBranchWeights(BranchInst &PreHeaderBI, BranchInst &LoopBI,
   }
 
   const uint32_t LoopBIWeights[] = {
-    SuccsSwapped ? LoopBackWeight : ExitWeight1,
-    SuccsSwapped ? ExitWeight1 : LoopBackWeight,
+      SuccsSwapped ? LoopBackWeight : ExitWeight1,
+      SuccsSwapped ? ExitWeight1 : LoopBackWeight,
   };
   setBranchWeights(LoopBI, LoopBIWeights);
   if (HasConditionalPreHeader) {
     const uint32_t PreHeaderBIWeights[] = {
-      SuccsSwapped ? EnterWeight : ExitWeight0,
-      SuccsSwapped ? ExitWeight0 : EnterWeight,
+        SuccsSwapped ? EnterWeight : ExitWeight0,
+        SuccsSwapped ? ExitWeight0 : EnterWeight,
     };
     setBranchWeights(PreHeaderBI, PreHeaderBIWeights);
   }

``````````

</details>


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


More information about the llvm-commits mailing list