[llvm] [Coverage] getMaxBitmapSize: Scan `max(BitmapIdx)` instead of the last `Decision` (PR #78963)

Alan Phipps via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 08:15:27 PST 2024


================
@@ -566,14 +567,14 @@ static unsigned getMaxBitmapSize(const CounterMappingContext &Ctx,
                                  const CoverageMappingRecord &Record) {
   unsigned MaxBitmapID = 0;
   unsigned NumConditions = 0;
-  // The last DecisionRegion has the highest bitmap byte index used in the
-  // function, which when combined with its number of conditions, yields the
-  // full bitmap size.
+  // Scan max(BitmapIdx).
+  // Note that `<=` is used insted of `<`, because `BitmapIdx == 0` is valid
+  // and `MaxbitmapID is `unsigned`. `BitmapIdx` is unique in the record.
   for (const auto &Region : reverse(Record.MappingRegions)) {
----------------
evodius96 wrote:

Since you need to check all MCDCDecisionRegions, don't need to look in reverse anymore.

https://github.com/llvm/llvm-project/pull/78963


More information about the llvm-commits mailing list