Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ Error CoverageMapping::loadFunctionRecord(
else
OrigFuncName = getFuncNameWithoutPrefix(OrigFuncName, Record.Filenames[0]);

bool SingleByteCoverage = ProfileReader.hasSingleByteCoverage();
CounterMappingContext Ctx(Record.Expressions);

std::vector<uint64_t> Counts;
Expand Down Expand Up @@ -870,8 +871,10 @@ Error CoverageMapping::loadFunctionRecord(
consumeError(std::move(E));
return Error::success();
}
Function.pushRegion(Region, *ExecutionCount, *AltExecutionCount,
ProfileReader.hasSingleByteCoverage());
Function.pushRegion(
Region, (SingleByteCoverage && *ExecutionCount ? 1 : *ExecutionCount),
(SingleByteCoverage && *AltExecutionCount ? 1 : *AltExecutionCount),
SingleByteCoverage);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last arg will be pruned after #110966.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll rewind this entirely with #110966 to make the viewer responsible to round counters.


// Record ExpansionRegion.
if (Region.Kind == CounterMappingRegion::ExpansionRegion) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-cov/Inputs/branch-logical-mixed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <stdio.h>
#include <stdlib.h>
// CHECK: |{{ +}}[[C4:4|1]]|void func(
// CHECK: | [[#min(C,4)]]|void func(
void func(int a, int b) {
bool b0 = a <= b;
bool b1 = a == b;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-cov/branch-macros.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// RUN: yaml2obj %S/Inputs/branch-macros-single.yaml -o %t.o
// RUN: llvm-profdata merge %S/Inputs/branch-macros-single.proftext -o %t.profdata
// RUN: llvm-cov show --show-expansions --show-branches=count %t.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp -D#C=999
// RUN: llvm-cov show --show-expansions --show-branches=count %t.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp -D#C=1

// REPORT: Name Regions Miss Cover Lines Miss Cover Branches Miss Cover
// REPORT-NEXT: ---
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-cov/showLineExecutionCounts.test
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@
// RUN: yaml2obj %S/Inputs/showLineExecutionCounts-single.yaml -o %t.o
// RUN: llvm-profdata merge %S/Inputs/showLineExecutionCounts-single.proftext -o %t.profdata

// RUN: llvm-cov show %t.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck -check-prefixes=TEXT,WHOLE-FILE -D#C=161 -DC16K2=161 -DC16K1=161 %S/Inputs/showLineExecutionCounts.cpp
// RUN: llvm-cov show %t.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs -name=main | FileCheck -check-prefixes=TEXT,FILTER -D#C=161 -DC16K2=161 -DC16K1=161 %S/Inputs/showLineExecutionCounts.cpp
// RUN: llvm-cov show %t.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck -check-prefixes=TEXT,WHOLE-FILE -D#C=1 -DC16K2=1 -DC16K1=1 %S/Inputs/showLineExecutionCounts.cpp
// RUN: llvm-cov show %t.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs -name=main | FileCheck -check-prefixes=TEXT,FILTER -D#C=1 -DC16K2=1 -DC16K1=1 %S/Inputs/showLineExecutionCounts.cpp
Loading