From 04bba52e1dbe84458595766deea88e6cf5358b50 Mon Sep 17 00:00:00 2001 From: Oscar Blumberg Date: Thu, 19 May 2016 21:22:33 -0400 Subject: [PATCH] fix align --- src/cgutils.cpp | 8 ++++---- src/intrinsics.cpp | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cgutils.cpp b/src/cgutils.cpp index 10a303f7c9331..a33136b695245 100644 --- a/src/cgutils.cpp +++ b/src/cgutils.cpp @@ -1354,16 +1354,16 @@ static Value *init_bits_value(Value *newv, Value *jt, Value *v, MDNode *tbaa) return newv; } static Value *as_value(Type *t, const jl_cgval_t&); -static Value *init_bits_cgval(Value *newv, const jl_cgval_t& v, MDNode *tbaa, Type *t) +static Value *init_bits_cgval(Value *newv, const jl_cgval_t& v, MDNode *tbaa, Type *t, jl_codectx_t *ctx) { Value *jt = literal_pointer_val(v.typ); if (v.ispointer()) { init_tag(newv, jt); - builder.CreateMemCpy(newv, v.V, jl_datatype_size(v.typ), sizeof(void*)); + builder.CreateMemCpy(newv, data_pointer(v,ctx,PointerType::get(t,0)), jl_datatype_size(v.typ), sizeof(void*)); return newv; } else { - return init_bits_value(newv, jt, as_value(t,v), tbaa); + return init_bits_value(newv, jt, v.V, tbaa); } } @@ -1530,7 +1530,7 @@ static Value *boxed(const jl_cgval_t &vinfo, jl_codectx_t *ctx, bool gcrooted) return literal_pointer_val(jb->instance); } else { - box = init_bits_cgval(emit_allocobj(jl_datatype_size(jt)), vinfo, jb->mutabl ? tbaa_mutab : tbaa_immut, t); + box = init_bits_cgval(emit_allocobj(jl_datatype_size(jt)), vinfo, jb->mutabl ? tbaa_mutab : tbaa_immut, t, ctx); } if (gcrooted) { diff --git a/src/intrinsics.cpp b/src/intrinsics.cpp index fa1a06c02b786..5d3d8e2b0deea 100644 --- a/src/intrinsics.cpp +++ b/src/intrinsics.cpp @@ -329,7 +329,9 @@ static Value *emit_unbox(Type *to, const jl_cgval_t &x, jl_value_t *jt, Value *d alignment = 0; } if (dest) { - builder.CreateMemCpy(dest, p, jl_datatype_size(jt), alignment); + // callers using the dest argument only use it for a stack slot for now + alignment = 0; + builder.CreateMemCpy(dest, p, jl_datatype_size(jt), alignment, false, x.tbaa); return NULL; } else {