Skip to content

Commit

Permalink
Properly declare alloca alignment (#46368)
Browse files Browse the repository at this point in the history
Turns out when you declare an alloca alignment, it also rounds up
the allocated size. Replaces #46322 and #46260 and fixes the
same issue.
  • Loading branch information
Keno authored Aug 16, 2022
1 parent ee37ef9 commit e358a17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7060,7 +7060,7 @@ static jl_llvm_functions_t
Type *vtype = julia_type_to_llvm(ctx, jt, &isboxed);
assert(!isboxed);
assert(!type_is_ghost(vtype) && "constants should already be handled");
Value *lv = new AllocaInst(vtype, M->getDataLayout().getAllocaAddrSpace(), jl_symbol_name(s), /*InsertBefore*/ctx.topalloca);
Value *lv = new AllocaInst(vtype, M->getDataLayout().getAllocaAddrSpace(), NULL, Align(jl_datatype_align(jt)), jl_symbol_name(s), /*InsertBefore*/ctx.topalloca);
if (CountTrackedPointers(vtype).count) {
StoreInst *SI = new StoreInst(Constant::getNullValue(vtype), lv, false, Align(sizeof(void*)));
SI->insertAfter(ctx.topalloca);
Expand Down

0 comments on commit e358a17

Please sign in to comment.