This commit is contained in:
gingerBill
2021-06-15 01:16:19 +01:00
parent 31f1e0aeae
commit 84a4188c72
+3
View File
@@ -293,6 +293,7 @@ void lb_emit_slice_bounds_check(lbProcedure *p, Token token, lbValue low, lbValu
bool lb_try_update_alignment(lbValue ptr, unsigned alignment) { bool lb_try_update_alignment(lbValue ptr, unsigned alignment) {
LLVMValueRef addr_ptr = ptr.value; LLVMValueRef addr_ptr = ptr.value;
if (LLVMIsAGlobalValue(addr_ptr) || LLVMIsAAllocaInst(addr_ptr) || LLVMIsALoadInst(addr_ptr)) {
if (LLVMGetAlignment(addr_ptr) < alignment) { if (LLVMGetAlignment(addr_ptr) < alignment) {
if (LLVMIsAAllocaInst(addr_ptr) || LLVMIsAGlobalValue(addr_ptr)) { if (LLVMIsAAllocaInst(addr_ptr) || LLVMIsAGlobalValue(addr_ptr)) {
LLVMSetAlignment(addr_ptr, alignment); LLVMSetAlignment(addr_ptr, alignment);
@@ -300,6 +301,8 @@ bool lb_try_update_alignment(lbValue ptr, unsigned alignment) {
} }
return LLVMGetAlignment(addr_ptr) >= alignment; return LLVMGetAlignment(addr_ptr) >= alignment;
} }
return false;
}
bool lb_try_vector_cast(lbModule *m, lbValue ptr, LLVMTypeRef *vector_type_) { bool lb_try_vector_cast(lbModule *m, lbValue ptr, LLVMTypeRef *vector_type_) {
Type *array_type = base_type(type_deref(ptr.type)); Type *array_type = base_type(type_deref(ptr.type));