[llvm] [Fuzzer] Adopt createUnlikelyBranchWeights in CreateGateBranch (PR #117398)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 22 15:11:31 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: None (thetruestblue)

<details>
<summary>Changes</summary>

Adopt the extracted branch weights method added here: https://github.com/llvm/llvm-project/commit/c60aa430dc4085d276a630699323068bf36bd9d8 


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


1 Files Affected:

- (modified) llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
index 139e75dd3ddb34..ae97c6fc86dae9 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -831,7 +831,7 @@ Instruction *ModuleSanitizerCoverage::CreateGateBranch(Function &F,
   // Set the branch weights in order to minimize the price paid when the
   // gate is turned off, allowing the default enablement of this
   // instrumentation with as little of a performance cost as possible
-  auto Weights = MDBuilder(*C).createBranchWeights(1, 100000);
+  auto Weights = MDBuilder(*C).createUnlikelyBranchWeights();
   return SplitBlockAndInsertIfThen(FunctionGateCmp, IP, false, Weights);
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list