Skip to content

Commit

Permalink
jitlayers: reduce excess alignment of #52182 (#52210)
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored Nov 20, 2023
1 parent c8ca350 commit 72cd63c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/jitlayers.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,9 @@ class MaxAlignedAllocImpl
// the returned pointer, this is >= alignof(std::max_align_t), which is too
// small often to actually use.
const size_t MaxAlignment = JL_CACHE_BYTE_ALIGNMENT;
return Align(std::min((size_t)llvm::PowerOf2Ceil(Size), MaxAlignment));
if (Size <= offset)
return Align(1);
return Align(std::min((size_t)llvm::PowerOf2Ceil(Size - offset), MaxAlignment));
}

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

0 comments on commit 72cd63c

Please sign in to comment.