llvm: optional slices cannot be passed in parts when they allowzero

Closes #18428
This commit is contained in:
Veikka Tuominen
2024-01-08 01:23:17 +02:00
parent 3f6e651d5a
commit faeb0ef032
2 changed files with 20 additions and 1 deletions

View File

@@ -11197,7 +11197,9 @@ const ParamTypeIterator = struct {
.Unspecified, .Inline => {
it.zig_index += 1;
it.llvm_index += 1;
if (ty.isSlice(mod) or (ty.zigTypeTag(mod) == .Optional and ty.optionalChild(mod).isSlice(mod))) {
if (ty.isSlice(mod) or
(ty.zigTypeTag(mod) == .Optional and ty.optionalChild(mod).isSlice(mod) and !ty.ptrAllowsZero(mod)))
{
it.llvm_index += 1;
return .slice;
} else if (isByRef(ty, mod)) {