Add align attribute for params pointers

master
LemonBoy 2019-02-17 23:39:13 +01:00 committed by Andrew Kelley
parent 74d9593d85
commit 7d762648a4
1 changed files with 3 additions and 0 deletions

View File

@ -2280,6 +2280,9 @@ void walk_function_params(CodeGen *g, ZigType *fn_type, FnWalk *fn_walk) {
if ((param_type->id == ZigTypeIdPointer && param_type->data.pointer.is_const) || is_byval) {
addLLVMArgAttr(llvm_fn, (unsigned)gen_index, "readonly");
}
if (get_codegen_ptr_type(param_type) != nullptr) {
addLLVMArgAttrInt(llvm_fn, (unsigned)gen_index, "align", get_ptr_align(g, param_type));
}
if (type_is_nonnull_ptr(param_type)) {
addLLVMArgAttr(llvm_fn, (unsigned)gen_index, "nonnull");
}