Skip to content

Commit

Permalink
jitlayers: reduce excess alignment of #52182 (#52210)
Browse files Browse the repository at this point in the history
(cherry picked from commit 72cd63c)
  • Loading branch information
vtjnash committed Nov 28, 2023
1 parent 332d9f3 commit 465ff74
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 @@ -312,7 +312,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 465ff74

Please sign in to comment.