From 8e4f3a6f15590402ee2a0f1d0cb3a9b62522e46e Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Wed, 24 Jul 2019 13:01:13 -0400 Subject: align src for IrInstructionArrayToVector closes #2942 --- src/codegen.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index be694b19f9..0ac945e8c2 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -5362,7 +5362,8 @@ static LLVMValueRef ir_render_vector_to_array(CodeGen *g, IrExecutable *executab LLVMValueRef vector = ir_llvm_value(g, instruction->vector); LLVMValueRef casted_ptr = LLVMBuildBitCast(g->builder, result_loc, LLVMPointerType(get_llvm_type(g, instruction->vector->value.type), 0), ""); - gen_store_untyped(g, vector, casted_ptr, get_ptr_align(g, instruction->result_loc->value.type), false); + uint32_t alignment = get_ptr_align(g, instruction->result_loc->value.type); + gen_store_untyped(g, vector, casted_ptr, alignment, false); return result_loc; } @@ -5375,7 +5376,10 @@ static LLVMValueRef ir_render_array_to_vector(CodeGen *g, IrExecutable *executab LLVMValueRef array_ptr = ir_llvm_value(g, instruction->array); LLVMValueRef casted_ptr = LLVMBuildBitCast(g->builder, array_ptr, LLVMPointerType(get_llvm_type(g, vector_type), 0), ""); - return gen_load_untyped(g, casted_ptr, 0, false, ""); + ZigType *array_type = instruction->array->value.type; + assert(array_type->id == ZigTypeIdArray); + uint32_t alignment = get_abi_alignment(g, array_type->data.array.child_type); + return gen_load_untyped(g, casted_ptr, alignment, false, ""); } static LLVMValueRef ir_render_assert_zero(CodeGen *g, IrExecutable *executable, -- cgit v1.2.3