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.

(cherry picked from commit e358a17)
  • Loading branch information
Keno authored and KristofferC committed Aug 26, 2022
1 parent ad8ca94 commit 29c76db
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 @@ -6709,7 +6709,7 @@ static std::pair<std::unique_ptr<Module>, 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, 0, jl_symbol_name(s), /*InsertBefore*/ctx.pgcstack);
Value *lv = new AllocaInst(vtype, 0, NULL, Align(jl_datatype_align(jt)), jl_symbol_name(s), /*InsertBefore*/ctx.pgcstack);
if (CountTrackedPointers(vtype).count) {
StoreInst *SI = new StoreInst(Constant::getNullValue(vtype), lv, false, Align(sizeof(void*)));
SI->insertAfter(ctx.pgcstack);
Expand Down

0 comments on commit 29c76db

Please sign in to comment.