@@ -301,7 +301,7 @@ static Value *emit_pointer_from_objref(jl_codectx_t &ctx, Value *V)
301
301
}
302
302
303
303
static Value *emit_unbox (jl_codectx_t &ctx, Type *to, const jl_cgval_t &x, jl_value_t *jt);
304
- static void emit_unbox_store (jl_codectx_t &ctx, const jl_cgval_t &x, Value* dest, MDNode *tbaa_dest, Align alignment , bool isVolatile=false );
304
+ static void emit_unbox_store (jl_codectx_t &ctx, const jl_cgval_t &x, Value* dest, MDNode *tbaa_dest, MaybeAlign align_src, Align align_dst , bool isVolatile=false );
305
305
306
306
static bool type_is_permalloc (jl_value_t *typ)
307
307
{
@@ -1090,7 +1090,7 @@ static void split_value_into(jl_codectx_t &ctx, const jl_cgval_t &x, Align align
1090
1090
return ;
1091
1091
}
1092
1092
if (inline_roots_ptr == nullptr ) {
1093
- emit_unbox_store (ctx, x, dst, ctx.tbaa ().tbaa_stack , align_dst, isVolatileStore);
1093
+ emit_unbox_store (ctx, x, dst, ctx.tbaa ().tbaa_stack , align_src, align_dst, isVolatileStore);
1094
1094
return ;
1095
1095
}
1096
1096
Value *src = data_pointer (ctx, value_to_pointer (ctx, x));
@@ -1152,7 +1152,7 @@ static void split_value_into(jl_codectx_t &ctx, const jl_cgval_t &x, Align align
1152
1152
return ;
1153
1153
}
1154
1154
if (inline_roots.empty ()) {
1155
- emit_unbox_store (ctx, x, dst, ctx.tbaa ().tbaa_stack , align_dst);
1155
+ emit_unbox_store (ctx, x, dst, ctx.tbaa ().tbaa_stack , align_src, align_dst, false );
1156
1156
return ;
1157
1157
}
1158
1158
Value *src = data_pointer (ctx, value_to_pointer (ctx, x));
@@ -2351,7 +2351,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx,
2351
2351
r = boxed (ctx, rhs);
2352
2352
}
2353
2353
else if (intcast) {
2354
- emit_unbox_store (ctx, rhs, intcast, ctx.tbaa ().tbaa_stack , intcast->getAlign ());
2354
+ emit_unbox_store (ctx, rhs, intcast, ctx.tbaa ().tbaa_stack , MaybeAlign (), intcast->getAlign ());
2355
2355
r = ctx.builder .CreateLoad (realelty, intcast);
2356
2356
}
2357
2357
else if (aliasscope || Order != AtomicOrdering::NotAtomic || (tracked_pointers && rhs.inline_roots .empty ())) {
@@ -2389,7 +2389,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx,
2389
2389
}
2390
2390
else {
2391
2391
assert (Order == AtomicOrdering::NotAtomic && !isboxed && rhs.typ == jltype);
2392
- emit_unbox_store (ctx, rhs, ptr, tbaa, Align (alignment));
2392
+ emit_unbox_store (ctx, rhs, ptr, tbaa, MaybeAlign (), Align (alignment));
2393
2393
}
2394
2394
}
2395
2395
else if (isswapfield) {
@@ -2438,7 +2438,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx,
2438
2438
}
2439
2439
cmp = update_julia_type (ctx, cmp, jltype);
2440
2440
if (intcast) {
2441
- emit_unbox_store (ctx, cmp, intcast, ctx.tbaa ().tbaa_stack , intcast->getAlign ());
2441
+ emit_unbox_store (ctx, cmp, intcast, ctx.tbaa ().tbaa_stack , MaybeAlign (), intcast->getAlign ());
2442
2442
Compare = ctx.builder .CreateLoad (realelty, intcast);
2443
2443
}
2444
2444
else {
@@ -2509,7 +2509,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx,
2509
2509
r = boxed (ctx, rhs);
2510
2510
}
2511
2511
else if (intcast) {
2512
- emit_unbox_store (ctx, rhs, intcast, ctx.tbaa ().tbaa_stack , intcast->getAlign ());
2512
+ emit_unbox_store (ctx, rhs, intcast, ctx.tbaa ().tbaa_stack , MaybeAlign (), intcast->getAlign ());
2513
2513
r = ctx.builder .CreateLoad (realelty, intcast);
2514
2514
if (!tracked_pointers) // oldval is a slot, so put the oldval back
2515
2515
ctx.builder .CreateStore (realCompare, intcast);
@@ -2556,7 +2556,7 @@ static jl_cgval_t typed_store(jl_codectx_t &ctx,
2556
2556
}
2557
2557
else {
2558
2558
assert (!isboxed && rhs.typ == jltype);
2559
- emit_unbox_store (ctx, rhs, ptr, tbaa, Align (alignment));
2559
+ emit_unbox_store (ctx, rhs, ptr, tbaa, MaybeAlign (), Align (alignment));
2560
2560
}
2561
2561
ctx.builder .CreateBr (DoneBB);
2562
2562
instr = load;
@@ -3352,9 +3352,10 @@ static void init_bits_value(jl_codectx_t &ctx, Value *newv, Value *v, MDNode *tb
3352
3352
static void init_bits_cgval (jl_codectx_t &ctx, Value *newv, const jl_cgval_t &v)
3353
3353
{
3354
3354
MDNode *tbaa = jl_is_mutable (v.typ ) ? ctx.tbaa ().tbaa_mutab : ctx.tbaa ().tbaa_immut ;
3355
- Align newv_align{std::max (julia_alignment (v.typ ), (unsigned )sizeof (void *))};
3355
+ unsigned alignment = julia_alignment (v.typ );
3356
+ unsigned newv_align = std::max (alignment, (unsigned )sizeof (void *));
3356
3357
newv = maybe_decay_tracked (ctx, newv);
3357
- emit_unbox_store (ctx, v, newv, tbaa, newv_align);
3358
+ emit_unbox_store (ctx, v, newv, tbaa, Align (alignment), Align ( newv_align) );
3358
3359
}
3359
3360
3360
3361
static jl_value_t *static_constant_instance (const llvm::DataLayout &DL, Constant *constant, jl_value_t *jt)
@@ -3808,7 +3809,7 @@ static void emit_unionmove(jl_codectx_t &ctx, Value *dest, MDNode *tbaa_dst, con
3808
3809
if (jl_is_pointerfree (typ)) {
3809
3810
emit_guarded_test (ctx, skip, nullptr , [&] {
3810
3811
unsigned alignment = julia_alignment (typ);
3811
- emit_unbox_store (ctx, mark_julia_const (ctx, src.constant ), dest, tbaa_dst, Align (alignment), isVolatile);
3812
+ emit_unbox_store (ctx, mark_julia_const (ctx, src.constant ), dest, tbaa_dst, Align (alignment), Align (alignment), isVolatile);
3812
3813
return nullptr ;
3813
3814
});
3814
3815
}
@@ -3818,7 +3819,7 @@ static void emit_unionmove(jl_codectx_t &ctx, Value *dest, MDNode *tbaa_dst, con
3818
3819
if (jl_is_pointerfree (src.typ )) {
3819
3820
emit_guarded_test (ctx, skip, nullptr , [&] {
3820
3821
unsigned alignment = julia_alignment (src.typ );
3821
- emit_unbox_store (ctx, src, dest, tbaa_dst, Align (alignment), isVolatile);
3822
+ emit_unbox_store (ctx, src, dest, tbaa_dst, Align (alignment), Align (alignment), isVolatile);
3822
3823
return nullptr ;
3823
3824
});
3824
3825
}
@@ -4273,6 +4274,8 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg
4273
4274
}
4274
4275
}
4275
4276
else {
4277
+ Align align_dst (jl_field_align (sty, i));
4278
+ Align align_src (julia_alignment (jtype));
4276
4279
if (field_promotable) {
4277
4280
fval_info.V ->replaceAllUsesWith (dest);
4278
4281
cast<Instruction>(fval_info.V )->eraseFromParent ();
@@ -4281,10 +4284,10 @@ static jl_cgval_t emit_new_struct(jl_codectx_t &ctx, jl_value_t *ty, size_t narg
4281
4284
fval = emit_unbox (ctx, fty, fval_info, jtype);
4282
4285
}
4283
4286
else if (!roots.empty ()) {
4284
- split_value_into (ctx, fval_info, Align ( julia_alignment (jtype)) , dest, Align ( jl_field_align (sty, i)) , jl_aliasinfo_t::fromTBAA (ctx, ctx.tbaa ().tbaa_stack ), roots);
4287
+ split_value_into (ctx, fval_info, align_src , dest, align_dst , jl_aliasinfo_t::fromTBAA (ctx, ctx.tbaa ().tbaa_stack ), roots);
4285
4288
}
4286
4289
else {
4287
- emit_unbox_store (ctx, fval_info, dest, ctx.tbaa ().tbaa_stack , Align ( jl_field_align (sty, i)) );
4290
+ emit_unbox_store (ctx, fval_info, dest, ctx.tbaa ().tbaa_stack , align_src, align_dst );
4288
4291
}
4289
4292
}
4290
4293
if (init_as_value) {
0 commit comments