Skip to content

[NFCI][metadata][LibCallsShrinkWrap] Use create{Unlikely,Likely}BranchWeights #89465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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}
2 changes: 1 addition & 1 deletion llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Loading