[all-commits] [llvm/llvm-project] 23f895: [InstrProf] Single byte counters in coverage (#75425)

gulfemsavrun via All-commits all-commits at lists.llvm.org
Mon Feb 26 14:45:07 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 23f895f6567e0a4cef45cfc9d96d817a454b6e8f
      https://github.com/llvm/llvm-project/commit/23f895f6567e0a4cef45cfc9d96d817a454b6e8f
  Author: gulfemsavrun <gulfem at google.com>
  Date:   2024-02-26 (Mon, 26 Feb 2024)

  Changed paths:
    M clang/lib/CodeGen/CGExprAgg.cpp
    M clang/lib/CodeGen/CGExprComplex.cpp
    M clang/lib/CodeGen/CGExprScalar.cpp
    M clang/lib/CodeGen/CGStmt.cpp
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/CodeGenPGO.cpp
    M clang/lib/CodeGen/CodeGenPGO.h
    M clang/lib/CodeGen/CoverageMappingGen.cpp
    A clang/test/CoverageMapping/single-byte-counters.cpp
    M compiler-rt/lib/profile/InstrProfiling.h
    M llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
    M llvm/include/llvm/ProfileData/InstrProfWriter.h
    M llvm/lib/ProfileData/Coverage/CoverageMapping.cpp

  Log Message:
  -----------
  [InstrProf] Single byte counters in coverage (#75425)

This patch inserts 1-byte counters instead of an 8-byte counters into
llvm profiles for source-based code coverage. The origial idea was
proposed as block-cov for PGO, and this patch repurposes that idea for
coverage: https://groups.google.com/g/llvm-dev/c/r03Z6JoN7d4

The current 8-byte counters mechanism add counters to minimal regions,
and infer the counters in the remaining regions via adding or
subtracting counters. For example, it infers the counter in the if.else
region by subtracting the counters between if.entry and if.then regions
in an if statement. Whenever there is a control-flow merge, it adds the
counters from all the incoming regions. However, we are not going to be
able to infer counters by subtracting two execution counts when using
single-byte counters. Therefore, this patch conservatively inserts
additional counters for the cases where we need to add or subtract
counters.

RFC:
https://discourse.llvm.org/t/rfc-single-byte-counters-for-source-based-code-coverage/75685



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list