From 7d762648a4f8cf20df3939a5b957bc751d6e4bb5 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sun, 17 Feb 2019 23:39:13 +0100 Subject: Add align attribute for params pointers --- src/codegen.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index d54d06f3b5..9085d4ea7c 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"); } -- cgit v1.2.3