[clang] [llvm] [SanitizerCoverage] Add gated tracing callbacks support to trace-cmp (PR #113227)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 10:39:48 PDT 2024


================
@@ -1013,19 +1051,10 @@ void ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
                       ConstantInt::get(IntptrTy, Idx * 4)),
         PtrTy);
     if (Options.GatedCallbacks) {
-      if (!FunctionGateCmp) {
-        // Create this in the entry block
-        assert(IsEntryBB);
-        FunctionGateCmp = CreateFunctionLocalGateCmp(IRB);
-      }
-      // 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);
----------------
vitalybuka wrote:

This can be converted to `auto Weights = MDBuilder(*C).createUnlikelyBranchWeights();`
In a separate patch if possible.


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


More information about the llvm-commits mailing list