@@ -948,20 +948,6 @@ struct CounterCoverageMappingBuilder
948
948
return {ExecCnt, Builder.subtract (ParentCnt, ExecCnt)};
949
949
}
950
950
951
- // / Returns {TrueCnt,FalseCnt} for "implicit default".
952
- // / FalseCnt is considered as the False count on SwitchStmt.
953
- std::pair<Counter, Counter>
954
- getSwitchImplicitDefaultCounterPair (const Stmt *Cond, Counter ParentCount,
955
- Counter CaseCountSum) {
956
- // Simplify is skipped while building the counters above: it can get
957
- // really slow on top of switches with thousands of cases. Instead,
958
- // trigger simplification by adding zero to the last counter.
959
- CaseCountSum =
960
- addCounters (CaseCountSum, Counter::getZero (), /* Simplify=*/ true );
961
-
962
- return {CaseCountSum, Builder.subtract (ParentCount, CaseCountSum)};
963
- }
964
-
965
951
bool IsCounterEqual (Counter OutCount, Counter ParentCount) {
966
952
if (OutCount == ParentCount)
967
953
return true ;
@@ -1920,9 +1906,15 @@ struct CounterCoverageMappingBuilder
1920
1906
// the hidden branch, which will be added later by the CodeGen. This region
1921
1907
// will be associated with the switch statement's condition.
1922
1908
if (!HasDefaultCase) {
1923
- auto Counters = getSwitchImplicitDefaultCounterPair (
1924
- S->getCond (), ParentCount, CaseCountSum);
1925
- createBranchRegion (S->getCond (), Counters.first , Counters.second );
1909
+ // Simplify is skipped while building the counters above: it can get
1910
+ // really slow on top of switches with thousands of cases. Instead,
1911
+ // trigger simplification by adding zero to the last counter.
1912
+ CaseCountSum =
1913
+ addCounters (CaseCountSum, Counter::getZero (), /* Simplify=*/ true );
1914
+
1915
+ // This is considered as the False count on SwitchStmt.
1916
+ Counter SwitchFalse = subtractCounters (ParentCount, CaseCountSum);
1917
+ createBranchRegion (S->getCond (), CaseCountSum, SwitchFalse);
1926
1918
}
1927
1919
}
1928
1920
0 commit comments