authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2019-07-24 13:01:13-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-24 15:04:32-04:00
log8e4f3a6f15590402ee2a0f1d0cb3a9b62522e46e
tree748e9732fdb0989a5e0c344dddc46828c3ac1444
parent59850c1ce12a325c8602d9201ab4a62ce12865bc

align src for IrInstructionArrayToVector

closes #2942

1 files changed, 6 insertions(+), 2 deletions(-)

src/codegen.cpp+6-2
...@@ -5362,7 +5362,8 @@ static LLVMValueRef ir_render_vector_to_array(CodeGen *g, IrExecutable *executab...@@ -5362,7 +5362,8 @@ static LLVMValueRef ir_render_vector_to_array(CodeGen *g, IrExecutable *executab
5362 LLVMValueRef vector = ir_llvm_value(g, instruction->vector);5362 LLVMValueRef vector = ir_llvm_value(g, instruction->vector);
5363 LLVMValueRef casted_ptr = LLVMBuildBitCast(g->builder, result_loc,5363 LLVMValueRef casted_ptr = LLVMBuildBitCast(g->builder, result_loc,
5364 LLVMPointerType(get_llvm_type(g, instruction->vector->value.type), 0), "");5364 LLVMPointerType(get_llvm_type(g, instruction->vector->value.type), 0), "");
5365 gen_store_untyped(g, vector, casted_ptr, get_ptr_align(g, instruction->result_loc->value.type), false);5365 uint32_t alignment = get_ptr_align(g, instruction->result_loc->value.type);
5366 gen_store_untyped(g, vector, casted_ptr, alignment, false);
5366 return result_loc;5367 return result_loc;
5367}5368}
53685369
...@@ -5375,7 +5376,10 @@ static LLVMValueRef ir_render_array_to_vector(CodeGen *g, IrExecutable *executab...@@ -5375,7 +5376,10 @@ static LLVMValueRef ir_render_array_to_vector(CodeGen *g, IrExecutable *executab
5375 LLVMValueRef array_ptr = ir_llvm_value(g, instruction->array);5376 LLVMValueRef array_ptr = ir_llvm_value(g, instruction->array);
5376 LLVMValueRef casted_ptr = LLVMBuildBitCast(g->builder, array_ptr,5377 LLVMValueRef casted_ptr = LLVMBuildBitCast(g->builder, array_ptr,
5377 LLVMPointerType(get_llvm_type(g, vector_type), 0), "");5378 LLVMPointerType(get_llvm_type(g, vector_type), 0), "");
5378 return gen_load_untyped(g, casted_ptr, 0, false, "");5379 ZigType *array_type = instruction->array->value.type;
5380 assert(array_type->id == ZigTypeIdArray);
5381 uint32_t alignment = get_abi_alignment(g, array_type->data.array.child_type);
5382 return gen_load_untyped(g, casted_ptr, alignment, false, "");
5379}5383}
53805384
5381static LLVMValueRef ir_render_assert_zero(CodeGen *g, IrExecutable *executable,5385static LLVMValueRef ir_render_assert_zero(CodeGen *g, IrExecutable *executable,