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

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 23:46:10 PDT 2024


================
@@ -149,21 +149,21 @@ class BumpPtrAllocatorImpl
     // Keep track of how many bytes we've allocated.
     BytesAllocated += Size;
 
-    size_t Adjustment = offsetToAlignedAddr(CurPtr, Alignment);
-    assert(Adjustment + Size >= Size && "Adjustment + Size must not overflow");
+    char *AlignedPtr = reinterpret_cast<char *>(alignAddr(CurPtr, Alignment));
----------------
resistor wrote:

Done

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


More information about the llvm-commits mailing list