[compiler-rt] [llvm] [MC/DC][Coverage] Introduce "Bitmap Bias" for continuous mode (PR #96126)

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 28 22:17:08 PDT 2024


================
@@ -260,7 +282,17 @@ static int mmapForContinuousMode(uint64_t CurrentFileOffset, FILE *File) {
   /* Return the memory allocated for counters to OS. */
   lprofReleaseMemoryPagesToOS((uintptr_t)CountersBegin, (uintptr_t)CountersEnd);
 
-  /* BIAS MODE not supported yet for Bitmap (MCDC). */
+  /* Also mmap MCDC bitmap bytes. If there aren't any bitmap bytes, mmap()
+   * will fail with EINVAL. */
+  if (NumBitmapBytes == 0)
+    return 0;
+
+  /* Update profbm_bias. */
+  uint64_t FileOffsetToBitmap =
+      FileOffsetToCounters + CountersSize + PaddingBytesAfterCounters;
+  /* Update the profile fields based on the current mapping. */
+  INSTR_PROF_PROFILE_BITMAP_BIAS_VAR =
+      (intptr_t)Profile - (uintptr_t)BitmapBegin + FileOffsetToBitmap;
----------------
ornata wrote:

should profile be uintptr_t?

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


More information about the llvm-commits mailing list