Skip to content

Commit 4e9b46d

Browse files
committed
Properly declare alloca alignment
Turns out when you declare an alloca alignment, it also rounds up the allocated size. Replaces #46322 and #46260 and fixes the same issue.
1 parent ee37ef9 commit 4e9b46d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7060,7 +7060,7 @@ static jl_llvm_functions_t
70607060
Type *vtype = julia_type_to_llvm(ctx, jt, &isboxed);
70617061
assert(!isboxed);
70627062
assert(!type_is_ghost(vtype) && "constants should already be handled");
7063-
Value *lv = new AllocaInst(vtype, M->getDataLayout().getAllocaAddrSpace(), jl_symbol_name(s), /*InsertBefore*/ctx.topalloca);
7063+
Value *lv = new AllocaInst(vtype, M->getDataLayout().getAllocaAddrSpace(), NULL, Align(jl_datatype_align(jt)), jl_symbol_name(s), /*InsertBefore*/ctx.topalloca);
70647064
if (CountTrackedPointers(vtype).count) {
70657065
StoreInst *SI = new StoreInst(Constant::getNullValue(vtype), lv, false, Align(sizeof(void*)));
70667066
SI->insertAfter(ctx.topalloca);

0 commit comments

Comments
 (0)