diff options
author | Justin Bogner <mail@justinbogner.com> | 2015-02-23 21:21:34 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2015-02-23 21:21:34 +0000 |
commit | 4d7aae932c48f0b1e16dc989a84a84a60befb437 (patch) | |
tree | 70361a699a1636e94eaf9bb4db5e6b684bdee073 /llvm/tools/llvm-cov/SourceCoverageView.h | |
parent | d487bb12d956480483bf6d537b56c81f47f09509 (diff) | |
download | bcm5719-llvm-4d7aae932c48f0b1e16dc989a84a84a60befb437.tar.gz bcm5719-llvm-4d7aae932c48f0b1e16dc989a84a84a60befb437.zip |
InstrProf: Teach llvm-cov to show the max count instead of the last
When multiple regions start on the same line, llvm-cov was just
showing the count of the last one as the line count. This can be
confusing and misleading for things like one-liner loops, where the
count at the end isn't very interesting, or even "if" statements with
an opening brace at the end of the line.
Instead, use the maximum of all of the region start counts.
llvm-svn: 230263
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageView.h')
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageView.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.h b/llvm/tools/llvm-cov/SourceCoverageView.h index d92a7486d9d..9e6fe5f3500 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.h +++ b/llvm/tools/llvm-cov/SourceCoverageView.h @@ -90,15 +90,14 @@ private: bool hasMultipleRegions() const { return RegionCount > 1; } void addRegionStartCount(uint64_t Count) { - Mapped = true; - ExecutionCount = Count; + // The max of all region starts is the most interesting value. + addRegionCount(RegionCount ? std::max(ExecutionCount, Count) : Count); ++RegionCount; } void addRegionCount(uint64_t Count) { Mapped = true; - if (!RegionCount) - ExecutionCount = Count; + ExecutionCount = Count; } }; |