Skip to content

Commit 7a76e32

Browse files
authored
codegen: fix alignment typos (#55880)
So easy to type jl_datatype_align to get the natural alignment instead of julia_alignment to get the actual alignment. This should fix the Revise workload. Change is visible with ``` julia> code_llvm(Random.XoshiroSimd.forkRand, (Random.TaskLocalRNG, Base.Val{8})) ```
1 parent 6e5e87b commit 7a76e32

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/cgutils.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3637,6 +3637,8 @@ static void union_alloca_type(jl_uniontype_t *ut,
36373637
},
36383638
(jl_value_t*)ut,
36393639
counter);
3640+
if (align > JL_HEAP_ALIGNMENT)
3641+
align = JL_HEAP_ALIGNMENT;
36403642
}
36413643

36423644
static AllocaInst *try_emit_union_alloca(jl_codectx_t &ctx, jl_uniontype_t *ut, bool &allunbox, size_t &min_align, size_t &nbytes)

src/codegen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5151,7 +5151,7 @@ static jl_cgval_t emit_call_specfun_other(jl_codectx_t &ctx, bool is_opaque_clos
51515151
Value *val = arg.V;
51525152
SmallVector<Value*,0> roots(arg.inline_roots);
51535153
if (roots.empty())
5154-
std::tie(val, roots) = split_value(ctx, arg, Align(jl_datatype_align(jt)));
5154+
std::tie(val, roots) = split_value(ctx, arg, Align(julia_alignment(jt)));
51555155
AllocaInst *proots = emit_static_roots(ctx, roots.size());
51565156
for (size_t i = 0; i < roots.size(); i++)
51575157
ctx.builder.CreateAlignedStore(roots[i], emit_ptrgep(ctx, proots, i * sizeof(void*)), Align(sizeof(void*)));
@@ -7859,7 +7859,7 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value
78597859
}
78607860
props.cc = jl_returninfo_t::SRet;
78617861
props.union_bytes = jl_datatype_size(jlrettype);
7862-
props.union_align = props.union_minalign = jl_datatype_align(jlrettype);
7862+
props.union_align = props.union_minalign = julia_alignment(jlrettype);
78637863
// sret is always passed from alloca
78647864
assert(M);
78657865
fsig.push_back(rt->getPointerTo(M->getDataLayout().getAllocaAddrSpace()));

0 commit comments

Comments
 (0)