[compiler-rt] [Memprof] Changes `HISTOGRAM_GRANULARITY` from 8U to 8ULL. (PR #100949)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 28 15:17:25 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-pgo

Author: Matthew Weingarten (mattweingarten)

<details>
<summary>Changes</summary>

This changes a bug in memprofiling with histogram where the shadow mask would be `0xFFFFFFF8` instead of `0xFFFFFFFFFFFFFFF8`, essentially discarding the upper 32 bits of the address. This can cause different addresses to be mapped to the same shadow address.

---
Full diff: https://github.com/llvm/llvm-project/pull/100949.diff


1 Files Affected:

- (modified) compiler-rt/lib/memprof/memprof_mapping.h (+1-1) 


``````````diff
diff --git a/compiler-rt/lib/memprof/memprof_mapping.h b/compiler-rt/lib/memprof/memprof_mapping.h
index fef8acfcfc921..6da385ab3d6e2 100644
--- a/compiler-rt/lib/memprof/memprof_mapping.h
+++ b/compiler-rt/lib/memprof/memprof_mapping.h
@@ -55,7 +55,7 @@ extern uptr kHighMemEnd; // Initialized in __memprof_init.
 // computed by summing up all individual 1 byte counters. This can incur an
 // accuracy penalty.
 
-#define HISTOGRAM_GRANULARITY 8U
+#define HISTOGRAM_GRANULARITY 8ULL
 
 #define HISTOGRAM_MAX_COUNTER 255U
 

``````````

</details>


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


More information about the llvm-commits mailing list