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

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 17:13:51 PST 2024


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

>From f325222fe9057aa65329836521065e2e6b1d9fc2 Mon Sep 17 00:00:00 2001
From: "xumingjie.enna1" <xumingjie.enna1 at bytedance.com>
Date: Thu, 25 Jan 2024 10:05:33 +0800
Subject: [PATCH] [MemProf][NFC] Rename DefaultShadowGranularity to
 DefaultMemGranularity 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.
---
 llvm/lib/Transforms/Instrumentation/MemProfiler.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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"),



More information about the llvm-commits mailing list