Skip to content

Commit 05df8df

Browse files
committed
Merge branch 'users/chapuni/cov/single/nextcount-base' into users/chapuni/cov/single/nextcount
2 parents 5e46059 + d4518a4 commit 05df8df

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,10 +1812,7 @@ struct CounterCoverageMappingBuilder
18121812
if (llvm::EnableSingleByteCoverage)
18131813
OutCount = getRegionCounter(S);
18141814
else {
1815-
LoopCount =
1816-
(ParentCount.isZero()
1817-
? ParentCount
1818-
: addCounters(ParentCount, BackedgeCount, BC.ContinueCount));
1815+
LoopCount = addCounters(ParentCount, BackedgeCount, BC.ContinueCount);
18191816
auto [ExecCount, SkipCount] = getBranchCounterPair(S, LoopCount);
18201817
ExitCount = SkipCount;
18211818
assert(ExecCount.isZero() || ExecCount == BodyCount);
@@ -1851,9 +1848,7 @@ struct CounterCoverageMappingBuilder
18511848
fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(), BodyCount);
18521849

18531850
Counter LoopCount =
1854-
(ParentCount.isZero()
1855-
? ParentCount
1856-
: addCounters(ParentCount, BackedgeCount, BC.ContinueCount));
1851+
addCounters(ParentCount, BackedgeCount, BC.ContinueCount);
18571852
auto [ExecCount, ExitCount] = getBranchCounterPair(S, LoopCount);
18581853
assert(ExecCount.isZero() || ExecCount == BodyCount);
18591854
Counter OutCount = addCounters(BC.BreakCount, ExitCount);

llvm/lib/ProfileData/Coverage/CoverageMapping.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,14 @@ Counter CounterExpressionBuilder::subtract(Counter LHS, Counter RHS,
136136
}
137137

138138
Counter CounterExpressionBuilder::replace(Counter C, const ReplaceMap &Map) {
139-
auto I = Map.find(C);
140-
141-
// Replace C with the Map even if C is Expression.
142-
if (I != Map.end())
139+
// Replace C with the value found in Map even if C is Expression.
140+
if (auto I = Map.find(C); I != Map.end())
143141
return I->second;
144142

145-
// Traverse only Expression.
146143
if (!C.isExpression())
147144
return C;
148145

146+
// Traverse both sides of Expression.
149147
auto CE = Expressions[C.getExpressionID()];
150148
auto NewLHS = replace(CE.LHS, Map);
151149
auto NewRHS = replace(CE.RHS, Map);
@@ -161,7 +159,7 @@ Counter CounterExpressionBuilder::replace(Counter C, const ReplaceMap &Map) {
161159
}
162160

163161
// Reconfirm if the reconstructed expression would hit the Map.
164-
if ((I = Map.find(C)) != Map.end())
162+
if (auto I = Map.find(C); I != Map.end())
165163
return I->second;
166164

167165
return C;

0 commit comments

Comments
 (0)