From aeacf3a9d8a1f6aa36d5c1315e1d8529bb985847 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 24 Aug 2022 13:07:41 +0100 Subject: Correct max alignment handling throughout the llvm backend --- src/llvm_backend_general.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/llvm_backend_general.cpp') diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp index 071986458..6f98458fa 100644 --- a/src/llvm_backend_general.cpp +++ b/src/llvm_backend_general.cpp @@ -591,6 +591,9 @@ bool lb_try_update_alignment(lbValue ptr, unsigned alignment) { return lb_try_update_alignment(ptr.value, alignment); } +bool lb_can_try_to_inline_array_arith(Type *t) { + return type_size_of(t) <= build_context.max_simd_align; +} bool lb_try_vector_cast(lbModule *m, lbValue ptr, LLVMTypeRef *vector_type_) { Type *array_type = base_type(type_deref(ptr.type)); @@ -599,7 +602,7 @@ bool lb_try_vector_cast(lbModule *m, lbValue ptr, LLVMTypeRef *vector_type_) { Type *elem_type = base_array_type(array_type); // TODO(bill): Determine what is the correct limit for doing vector arithmetic - if (type_size_of(array_type) <= build_context.max_align && + if (lb_can_try_to_inline_array_arith(array_type) && is_type_valid_vector_elem(elem_type)) { // Try to treat it like a vector if possible bool possible = false; -- cgit v1.2.3