aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2024-10-20 12:30:35 +0900
committerGitHub <noreply@github.com>2024-10-20 12:30:35 +0900
commit4a011ac84fa16f7eed34c309bdac5591d9553da7 (patch)
treea10ddc411322a8a737f84130e554fa36a0777f8f /llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
parent1336e3d0b9a361fbbe2d97f225ef6757d20df51a (diff)
downloadllvm-4a011ac84fa16f7eed34c309bdac5591d9553da7.zip
llvm-4a011ac84fa16f7eed34c309bdac5591d9553da7.tar.gz
llvm-4a011ac84fa16f7eed34c309bdac5591d9553da7.tar.bz2
[Coverage] Introduce "partial fold" on BranchRegion (#112694)
Currently both True/False counts were folded. It lost the information, "It is True or False before folding." It prevented recalling branch counts in merging template instantiations. In `llvm-cov`, a folded branch is shown as: - `[True: n, Folded]` - `[Folded, False n]` In the case If `n` is zero, a branch is reported as "uncovered". This is distinguished from "folded" branch. When folded branches are merged, `Folded` may be dissolved. In the coverage map, either `Counter` is `Zero`. Currently both were `Zero`. Since "partial fold" has been introduced, either case in `switch` is omitted as `Folded`. Each `case:` in `switch` is reported as `[True: n, Folded]`, since `False` count doesn't show meaningful value. When `switch` doesn't have `default:`, `switch (Cond)` is reported as `[Folded, False: n]`, since `True` count was just the sum of `case`(s). `switch` with `default` can be considered as "the statement that doesn't have any `False`(s)".
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMapping.cpp')
-rw-r--r--llvm/lib/ProfileData/Coverage/CoverageMapping.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index c713371..119e091 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -503,7 +503,7 @@ public:
const auto &BranchParams = B->getBranchParams();
PosToID[I] = BranchParams.ID;
CondLoc[I] = B->startLoc();
- Folded[I++] = (B->Count.isZero() && B->FalseCount.isZero());
+ Folded[I++] = (B->Count.isZero() || B->FalseCount.isZero());
}
// Using Profile Bitmap from runtime, mark the executed test vectors.