diff options
| author | gingerBill <bill@gingerbill.org> | 2022-08-24 13:07:41 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-08-24 13:07:41 +0100 |
| commit | aeacf3a9d8a1f6aa36d5c1315e1d8529bb985847 (patch) | |
| tree | 935f950fa5dd1690dc57df3001410928bd5d1e3a /src/llvm_backend_general.cpp | |
| parent | 4ba486baa2d1414393dff0d7ddaff777f4592cbd (diff) | |
Correct max alignment handling throughout the llvm backend
Diffstat (limited to 'src/llvm_backend_general.cpp')
| -rw-r--r-- | src/llvm_backend_general.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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; |