diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-10-31 09:00:46 +0100 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-05-12 17:07:49 +0200 |
| commit | e9ae9a5fc45a6ee85d988372a4d150032f52ef4c (patch) | |
| tree | 9bcaf23acc82aa68b77121b304df17a0245bbe4a /src/codegen | |
| parent | e95e7651ecd988d4955a46c7adfea29c0996c62f (diff) | |
| download | zig-e9ae9a5fc45a6ee85d988372a4d150032f52ef4c.tar.gz zig-e9ae9a5fc45a6ee85d988372a4d150032f52ef4c.zip | |
llvm: Don't set nonnull attribute on allowzero slices.
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/llvm.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 0c6aaa66fb..0bbc3aee46 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -1341,7 +1341,7 @@ pub const Object = struct { try attributes.addParamAttr(llvm_arg_i, .@"noalias", &o.builder); } } - if (param_ty.zigTypeTag(zcu) != .optional) { + if (param_ty.zigTypeTag(zcu) != .optional and !ptr_info.flags.is_allowzero) { try attributes.addParamAttr(llvm_arg_i, .nonnull, &o.builder); } if (ptr_info.flags.is_const) { @@ -5410,7 +5410,7 @@ pub const FuncGen = struct { try attributes.addParamAttr(llvm_arg_i, .@"noalias", &o.builder); } } - if (param_ty.zigTypeTag(zcu) != .optional) { + if (param_ty.zigTypeTag(zcu) != .optional and !ptr_info.flags.is_allowzero) { try attributes.addParamAttr(llvm_arg_i, .nonnull, &o.builder); } if (ptr_info.flags.is_const) { |
