From 356a865b871db458149f70bc103a3971780d6962 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 31 May 2022 17:38:42 -0700 Subject: stage2: introduce support for noalias Not implemented yet is enhancements to coerceInMemory to account for noalias parameters. Related to #11498. --- src/codegen/llvm.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/codegen') diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index a6ea6255e3..34203b9536 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -725,8 +725,12 @@ pub const Object = struct { try args.append(param); if (param_ty.isPtrAtRuntime()) { - // TODO noalias attribute const ptr_info = param_ty.ptrInfo().data; + if (math.cast(u5, it.zig_index - 1)) |i| { + if (@truncate(u1, fn_info.noalias_bits >> i) != 0) { + dg.addArgAttr(llvm_func, llvm_arg_i, "noalias"); + } + } if (!param_ty.isPtrLikeOptional() and !ptr_info.@"allowzero") { dg.addArgAttr(llvm_func, llvm_arg_i, "nonnull"); } -- cgit v1.2.3