[llvm] [offload] add handling of memory alignment to MemoryManagerTy (PR #218418)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 00:11:07 PDT 2026


================
@@ -248,72 +260,102 @@ class MemoryManagerTy {
     if (Size == 0)
       return nullptr;
 
-    ODBG(OLDT_Alloc) << "MemoryManagerTy::allocate: size " << Size
+    size_t AllocationSize = Alignment > 0 ? (Size + Alignment - 1) : Size;
----------------
blazej-smorawski wrote:

I was thinking if the scenario should be handled, because it's the user who requests some unreal amount of memory. But actually if we don't handle it here, for number such as `(size_t)0 - 1` we will return a small allocation when the expected behavior would be to crash. 

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


More information about the llvm-commits mailing list