[llvm] [offload] add handling of memory alignment to MemoryManagerTy (PR #218418)
Jan Trusiłło via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 03:36:57 PDT 2026
================
@@ -218,6 +222,19 @@ class MemoryManagerTy {
return TgtPtr;
}
+ void changeKeyPtr(void *FinalPtr, NodeTy *NodePtr) {
+ std::lock_guard<std::mutex> LG(MapTableLock);
+ auto NodeHandle = PtrToNodeTable.extract(NodePtr->Ptr);
+ NodeHandle.mapped().Ptr = FinalPtr;
+ NodeHandle.key() = FinalPtr;
+ PtrToNodeTable.insert(std::move(NodeHandle));
+ }
+
+ void *alignPointer(void *PtrToBeAligned, size_t Alignment) {
----------------
311Volt wrote:
`"llvm/Support/Alignment.h"` is already included, so this can be written as:
```
void *alignPointer(void *Ptr, size_t Alignment) {
return reinterpret_cast<void *>(alignAddr(Ptr, Align(Alignment)));
}
```
which behaves the same, except you also get `assert()`s against address overflow and non-power-of-two alignments
https://github.com/llvm/llvm-project/pull/218418
More information about the llvm-commits
mailing list