diff options
| author | Justin Bogner <mail@justinbogner.com> | 2015-02-19 03:10:30 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2015-02-19 03:10:30 +0000 |
| commit | 91f2e3c9c2650795d95c80a7f922054ca74c1ac5 (patch) | |
| tree | 4b102469f03aa1e8ac71b35eb4f813b61cd152c9 /clang/lib | |
| parent | 62d8aa5caf0a2a7b699b2dc5d98b1fdcd8b6053d (diff) | |
| download | bcm5719-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.cpp | 5 |
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()); |

