[compiler-rt] [llvm] [MC/DC][Coverage] Introduce "Bitmap Bias" for continuous mode (PR #96126)
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 28 22:25:01 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;
----------------
chapuni wrote:
Yes, it should be unaware of wrapping-around. It was copypasto from `INSTR_PROF_PROFILE_COUNTER_BIAS_VAR`.
https://github.com/llvm/llvm-project/pull/96126
More information about the llvm-commits
mailing list