[llvm] [MemProf][NFC] Rename DefaultShadowGranularity to DefaultMemGranulari… (PR #79412)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 23:15:17 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Enna1 (Enna1)

<details>
<summary>Changes</summary>

…ty in instrumentation code, be consistent with runtime

In runtime code, the size of memory block mapped to a single shadow location is called MEM_GRANULARITY.
In instrumentation code, the size of memory block mapped to a single shadow location is called DefaultShadowGranularity.
Actually, the SHADOW_GRANULARITY is 8 (1 << SHADOW_SCALE), and the MEM_GRANULARITY is 64.
The wording of DefaultShadowGranularity in instrumentation code is a bit misleading, this patch renames DefaultShadowGranularity to DefaultMemGranularity, be consistent with runtime.

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


1 Files Affected:

- (modified) llvm/lib/Transforms/Instrumentation/MemProfiler.cpp (+2-2) 


``````````diff
diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index 5123ed771c9d638..2445ba7f0dda993 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -59,7 +59,7 @@ extern cl::opt<bool> NoPGOWarnMismatchComdatWeak;
 constexpr int LLVM_MEM_PROFILER_VERSION = 1;
 
 // Size of memory mapped to a single shadow location.
-constexpr uint64_t DefaultShadowGranularity = 64;
+constexpr uint64_t DefaultMemGranularity = 64;
 
 // Scale from granularity down to shadow size.
 constexpr uint64_t DefaultShadowScale = 3;
@@ -120,7 +120,7 @@ static cl::opt<int> ClMappingScale("memprof-mapping-scale",
 static cl::opt<int>
     ClMappingGranularity("memprof-mapping-granularity",
                          cl::desc("granularity of memprof shadow mapping"),
-                         cl::Hidden, cl::init(DefaultShadowGranularity));
+                         cl::Hidden, cl::init(DefaultMemGranularity));
 
 static cl::opt<bool> ClStack("memprof-instrument-stack",
                              cl::desc("Instrument scalar stack variables"),

``````````

</details>


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


More information about the llvm-commits mailing list