[llvm-branch-commits] [NFCI][metadata][LibCallsShrinkWrap] Use create{Unlikely, Likely}BranchWeights (PR #89465)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Apr 19 15:24:57 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>

It does not look like 2000 is needed here in particular.


---
Full diff: https://github.com/llvm/llvm-project/pull/89465.diff


4 Files Affected:

- (modified) llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp (+1-1) 
- (modified) llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll (+1-1) 
- (modified) llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll (+1-1) 
- (modified) llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll (+1-1) 


``````````diff
diff --git a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
index 6220f850930969..9fe655e548c22c 100644
--- a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
+++ b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
@@ -467,7 +467,7 @@ Value *LibCallsShrinkWrap::generateCondForPow(CallInst *CI,
 void LibCallsShrinkWrap::shrinkWrapCI(CallInst *CI, Value *Cond) {
   assert(Cond != nullptr && "ShrinkWrapCI is not expecting an empty call inst");
   MDNode *BranchWeights =
-      MDBuilder(CI->getContext()).createBranchWeights(1, 2000);
+      MDBuilder(CI->getContext()).createUnlikelyBranchWeights();
 
   Instruction *NewInst =
       SplitBlockAndInsertIfThen(Cond, CI, false, BranchWeights, &DTU);
diff --git a/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll b/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll
index 1866fc98fc8d8b..4ac216f85c74c0 100644
--- a/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll
+++ b/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll
@@ -448,4 +448,4 @@ define void @test_pow_strictfp(i32 %int_val, double %exp) strictfp {
 
 declare double @pow(double, double)
 
-; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 2000}
+; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 1048575}
diff --git a/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll b/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll
index 2a08041e2b1e5f..f4dc79759d17ed 100644
--- a/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll
+++ b/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll
@@ -350,4 +350,4 @@ declare float @log2f(float)
 declare float @logbf(float)
 declare float @log1pf(float)
 
-; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 2000}
+; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 1048575}
diff --git a/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll b/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll
index 076e958086daaf..c2b981c81c75d7 100644
--- a/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll
+++ b/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll
@@ -351,4 +351,4 @@ declare x86_fp80 @log2l(x86_fp80)
 declare x86_fp80 @logbl(x86_fp80)
 declare x86_fp80 @log1pl(x86_fp80)
 
-; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 2000}
+; CHECK: ![[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 1048575}

``````````

</details>


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


More information about the llvm-branch-commits mailing list