summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-02-19 03:10:30 +0000
committerJustin Bogner <mail@justinbogner.com>2015-02-19 03:10:30 +0000
commit91f2e3c9c2650795d95c80a7f922054ca74c1ac5 (patch)
tree4b102469f03aa1e8ac71b35eb4f813b61cd152c9 /clang/lib
parent62d8aa5caf0a2a7b699b2dc5d98b1fdcd8b6053d (diff)
downloadbcm5719-llvm-91f2e3c9c2650795d95c80a7f922054ca74c1ac5.tar.gz
bcm5719-llvm-91f2e3c9c2650795d95c80a7f922054ca74c1ac5.zip
InstrProf: Always emit a coverage region for the condition of an if
When tools like llvm-cov show regions, it's much easier to understand what's happening if the condition of an if shows a counter as well as the body. llvm-svn: 229813
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CoverageMappingGen.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index ad4a9753bb1..4bd4eb6da2e 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -787,11 +787,14 @@ struct CounterCoverageMappingBuilder
void VisitIfStmt(const IfStmt *S) {
extendRegion(S);
- Visit(S->getCond());
Counter ParentCount = getRegion().getCounter();
Counter ThenCount = getRegionCounter(S);
+ // Emitting a counter for the condition makes it easier to interpret the
+ // counter for the body when looking at the coverage.
+ propagateCounts(ParentCount, S->getCond());
+
extendRegion(S->getThen());
Counter OutCount = propagateCounts(ThenCount, S->getThen());
OpenPOWER on IntegriCloud