Skip to content

Commit 649f568

Browse files
KenoKristofferC
authored andcommitted
Properly declare alloca alignment (#46368)
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)
1 parent 6115c4a commit 649f568

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/codegen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6709,7 +6709,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
67096709
Type *vtype = julia_type_to_llvm(ctx, jt, &isboxed);
67106710
assert(!isboxed);
67116711
assert(!type_is_ghost(vtype) && "constants should already be handled");
6712-
Value *lv = new AllocaInst(vtype, 0, jl_symbol_name(s), /*InsertBefore*/ctx.pgcstack);
6712+
Value *lv = new AllocaInst(vtype, 0, NULL, Align(jl_datatype_align(jt)), jl_symbol_name(s), /*InsertBefore*/ctx.pgcstack);
67136713
if (CountTrackedPointers(vtype).count) {
67146714
StoreInst *SI = new StoreInst(Constant::getNullValue(vtype), lv, false, Align(sizeof(void*)));
67156715
SI->insertAfter(ctx.pgcstack);

0 commit comments

Comments
 (0)