[all-commits] [llvm/llvm-project] 5a57b0: [InstrProf][WIP] Implement boolean counters in cov...
gulfemsavrun via All-commits
all-commits at lists.llvm.org
Thu Aug 4 16:42:44 PDT 2022
Branch: refs/heads/boolean-counters-merge
Home: https://github.com/llvm/llvm-project
Commit: 5a57b0db5592d76e325c4e74ae993c9e376d4bd4
https://github.com/llvm/llvm-project/commit/5a57b0db5592d76e325c4e74ae993c9e376d4bd4
Author: Gulfem Savrun Yeniceri <gulfem at google.com>
Date: 2022-08-01 (Mon, 01 Aug 2022)
Changed paths:
M clang/lib/CodeGen/CGStmt.cpp
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/boolean-counters.cpp
M llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
M llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
M llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
Log Message:
-----------
[InstrProf][WIP] Implement boolean counters in coverage
This patch inserts 1-byte boolean 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 reuses that idea for coverage.
https://groups.google.com/g/llvm-dev/c/r03Z6JoN7d4
This is a WIP prototype implementation which only implements boolean
counters for only a handful of control-flow statements (while, for, if, switch).
I will continue to extend it for other control-flow statements.
The current 8-byte counters mechanism add counters to minimal regions,
and infer the counters in the remaining regions via adding or
subtracting counters. Whenever there is control-flow merge, it adds
the counters from all the incoming regions. When we use boolean counters,
we can use a new counter expression called `or` instead of an and for such
cases. Therefore, this patch adds an Or kind into CounterExpression.
Similarly, 8-byte counters mechanism infers the counters in some regions
by 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. However, we are not going to be able to infer counters
by subtracting two execution counts when using boolean counters.
Therefore, we need to insert additional counters for the cases where we
need to subtract counters.
More information about the All-commits
mailing list