diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-05-31 17:38:42 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-05-31 17:38:42 -0700 |
| commit | 356a865b871db458149f70bc103a3971780d6962 (patch) | |
| tree | c4e06c84ce3735b48add6e89c69cf6cc3e84da1c /src/codegen/llvm.zig | |
| parent | 602af1b88f150f8b09d980520620ab289c425075 (diff) | |
| download | zig-356a865b871db458149f70bc103a3971780d6962.tar.gz zig-356a865b871db458149f70bc103a3971780d6962.zip | |
stage2: introduce support for noalias
Not implemented yet is enhancements to coerceInMemory to account for
noalias parameters.
Related to #11498.
Diffstat (limited to 'src/codegen/llvm.zig')
| -rw-r--r-- | src/codegen/llvm.zig | 6 |
1 files changed, 5 insertions, 1 deletions
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"); } |
