diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2026-01-22 13:18:22 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2026-01-22 13:18:22 +0000 |
| commit | dc6067a8a988477446181ca428553948821ec06c (patch) | |
| tree | 6b1dcd3629623d5bdbda39bff2473cbb19729c50 /src | |
| parent | b0064f38cfb7f24d760feb010c09472fc7f896ee (diff) | |
Unify "mem*.inline" logic to only inline for <=8 bytes on all platforms
Diffstat (limited to 'src')
| -rw-r--r-- | src/llvm_backend.hpp | 2 | ||||
| -rw-r--r-- | src/llvm_backend_proc.cpp | 8 | ||||
| -rw-r--r-- | src/llvm_backend_utility.cpp | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/llvm_backend.hpp b/src/llvm_backend.hpp index e10471527..3491c0d39 100644 --- a/src/llvm_backend.hpp +++ b/src/llvm_backend.hpp @@ -619,7 +619,7 @@ gb_internal LLVMValueRef lb_mem_zero_ptr_internal(lbProcedure *p, LLVMValueRef p gb_internal LLVMValueRef lb_mem_zero_ptr_internal(lbProcedure *p, LLVMValueRef ptr, usize len, unsigned alignment, bool is_volatile); gb_internal gb_inline i64 lb_max_zero_init_size(void) { - return cast(i64)(4*build_context.int_size); + return cast(i64)(8); } gb_internal LLVMTypeRef OdinLLVMGetArrayElementType(LLVMTypeRef type); diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp index 640a43111..837d7ce48 100644 --- a/src/llvm_backend_proc.cpp +++ b/src/llvm_backend_proc.cpp @@ -12,9 +12,9 @@ gb_internal void lb_mem_copy_overlapping(lbProcedure *p, lbValue dst, lbValue sr len = lb_emit_conv(p, len, t_int); char const *name = "llvm.memmove"; - if (LLVMIsConstant(len.value)) { + if (!p->is_startup && LLVMIsConstant(len.value)) { i64 const_len = cast(i64)LLVMConstIntGetSExtValue(len.value); - if (const_len <= 4*build_context.int_size) { + if (const_len <= lb_max_zero_init_size()) { name = "llvm.memmove.inline"; } } @@ -41,9 +41,9 @@ gb_internal void lb_mem_copy_non_overlapping(lbProcedure *p, lbValue dst, lbValu len = lb_emit_conv(p, len, t_int); char const *name = "llvm.memcpy"; - if (LLVMIsConstant(len.value)) { + if (!p->is_startup && LLVMIsConstant(len.value)) { i64 const_len = cast(i64)LLVMConstIntGetSExtValue(len.value); - if (const_len <= 4*build_context.int_size) { + if (const_len <= lb_max_zero_init_size()) { name = "llvm.memcpy.inline"; } } diff --git a/src/llvm_backend_utility.cpp b/src/llvm_backend_utility.cpp index 9ddbd1f9c..43cac70c1 100644 --- a/src/llvm_backend_utility.cpp +++ b/src/llvm_backend_utility.cpp @@ -89,7 +89,7 @@ gb_internal LLVMValueRef lb_mem_zero_ptr_internal(lbProcedure *p, LLVMValueRef p bool is_inlinable = false; i64 const_len = 0; - if (LLVMIsConstant(len)) { + if (!p->is_startup && LLVMIsConstant(len)) { const_len = cast(i64)LLVMConstIntGetSExtValue(len); // TODO(bill): Determine when it is better to do the `*.inline` versions if (const_len <= lb_max_zero_init_size()) { |