Skip to content

Commit 72cd63c

Browse files
authored
jitlayers: reduce excess alignment of #52182 (#52210)
1 parent c8ca350 commit 72cd63c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/jitlayers.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ class MaxAlignedAllocImpl
306306
// the returned pointer, this is >= alignof(std::max_align_t), which is too
307307
// small often to actually use.
308308
const size_t MaxAlignment = JL_CACHE_BYTE_ALIGNMENT;
309-
return Align(std::min((size_t)llvm::PowerOf2Ceil(Size), MaxAlignment));
309+
if (Size <= offset)
310+
return Align(1);
311+
return Align(std::min((size_t)llvm::PowerOf2Ceil(Size - offset), MaxAlignment));
310312
}
311313

312314
LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate(size_t Size, Align Alignment) {

0 commit comments

Comments
 (0)