[llvm] Simplify hot-path size computations in BumpPtrAllocator. (PR #101312)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 02:42:47 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 07d2709a17860a202d91781769a88837e4fb5f2a d5cc47831ecd9f0a2b164b16da67f74b94e9aafc --extensions h -- llvm/include/llvm/Support/Allocator.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h
index d9a4f6599e..26ea8d6f47 100644
--- a/llvm/include/llvm/Support/Allocator.h
+++ b/llvm/include/llvm/Support/Allocator.h
@@ -149,7 +149,7 @@ public:
     // Keep track of how many bytes we've allocated.
     BytesAllocated += Size;
 
-    char* AlignedPtr = reinterpret_cast<char*>(alignAddr(CurPtr, Alignment));
+    char *AlignedPtr = reinterpret_cast<char *>(alignAddr(CurPtr, Alignment));
 
     size_t SizeToAllocate = Size;
 #if LLVM_ADDRESS_SANITIZER_BUILD
@@ -157,7 +157,7 @@ public:
     SizeToAllocate += RedZoneSize;
 #endif
 
-    char* AllocEndPtr = AlignedPtr + SizeToAllocate;
+    char *AllocEndPtr = AlignedPtr + SizeToAllocate;
 
     // Check if we have enough space.
     if (LLVM_LIKELY(AllocEndPtr <= End

``````````

</details>


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


More information about the llvm-commits mailing list