diff --git a/src/codegen.cpp b/src/codegen.cpp index d54d06f3b..9085d4ea7 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -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"); }