[compiler-rt] [scudo] Use variable instead of recomputing. (PR #106647)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 29 17:30:55 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Christopher Ferris (cferris1000)
<details>
<summary>Changes</summary>
In the getStats() function, there is already a variable that computes the in use bytes, so use that instead of recomputing it.
---
Full diff: https://github.com/llvm/llvm-project/pull/106647.diff
2 Files Affected:
- (modified) compiler-rt/lib/scudo/standalone/primary32.h (+1-1)
- (modified) compiler-rt/lib/scudo/standalone/primary64.h (+1-1)
``````````diff
diff --git a/compiler-rt/lib/scudo/standalone/primary32.h b/compiler-rt/lib/scudo/standalone/primary32.h
index ebfb8dfe0a31f4..87264471be2c1a 100644
--- a/compiler-rt/lib/scudo/standalone/primary32.h
+++ b/compiler-rt/lib/scudo/standalone/primary32.h
@@ -940,7 +940,7 @@ template <typename Config> class SizeClassAllocator32 {
uptr Integral;
uptr Fractional;
- computePercentage(BlockSize * InUseBlocks, InUsePages * PageSize, &Integral,
+ computePercentage(BlockSize * InUseBlocks, InUseBytes, &Integral,
&Fractional);
Str->append(" %02zu (%6zu): inuse/total blocks: %6zu/%6zu inuse/total "
"pages: %6zu/%6zu inuse bytes: %6zuK util: %3zu.%02zu%%\n",
diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index 8436f33c2fdcfc..ffcc22fea0c6ea 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -1185,7 +1185,7 @@ template <typename Config> class SizeClassAllocator64 {
uptr Integral;
uptr Fractional;
- computePercentage(BlockSize * InUseBlocks, InUsePages * PageSize, &Integral,
+ computePercentage(BlockSize * InUseBlocks, InUseBytes, &Integral,
&Fractional);
Str->append(" %02zu (%6zu): inuse/total blocks: %6zu/%6zu inuse/total "
"pages: %6zu/%6zu inuse bytes: %6zuK util: %3zu.%02zu%%\n",
``````````
</details>
https://github.com/llvm/llvm-project/pull/106647
More information about the llvm-commits
mailing list