From 7a85ad151daece3d0bba3c8d23081502a0956c95 Mon Sep 17 00:00:00 2001 From: mlugg Date: Sat, 19 Aug 2023 02:35:00 +0100 Subject: cbe: elide block result allocation for 0-bit types This logic already existed for the void type, but is also necessary for other 0-bit types. Without it, we try to alloc a local for a 0-bit type which gets translated to a local of type `void` which C doesn't like. --- src/codegen/c.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/codegen') diff --git a/src/codegen/c.zig b/src/codegen/c.zig index bea3c02985..330a9b33e8 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -4285,7 +4285,7 @@ fn airBlock(f: *Function, inst: Air.Inst.Index) !CValue { const writer = f.object.writer(); const inst_ty = f.typeOfIndex(inst); - const result = if (inst_ty.ip_index != .void_type and !f.liveness.isUnused(inst)) + const result = if (inst_ty.hasRuntimeBitsIgnoreComptime(mod) and !f.liveness.isUnused(inst)) try f.allocLocal(inst, inst_ty) else .none; -- cgit v1.2.3 From 4ac20f69acd446e6d9ac59f1fc4172147c05559e Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Sat, 19 Aug 2023 04:45:05 -0400 Subject: Revert "llvm: fix bootstrap" This reverts commit ea72fea1a4e2bc8309c211308f49f7f2c38507be. --- src/codegen/llvm/Builder.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/codegen') diff --git a/src/codegen/llvm/Builder.zig b/src/codegen/llvm/Builder.zig index 9632beef3a..00b3826d7d 100644 --- a/src/codegen/llvm/Builder.zig +++ b/src/codegen/llvm/Builder.zig @@ -10092,8 +10092,8 @@ fn vectorTypeAssumeCapacity( .data = self.addTypeExtraAssumeCapacity(data), }); if (self.useLibLlvm()) self.llvm.types.appendAssumeCapacity(switch (kind) { - .normal => llvm.Type.vectorType, - .scalable => llvm.Type.scalableVectorType, + .normal => &llvm.Type.vectorType, + .scalable => &llvm.Type.scalableVectorType, }(child.toLlvm(self), @intCast(len))); } return @enumFromInt(gop.index); @@ -11274,8 +11274,8 @@ fn gepConstAssumeCapacity( for (llvm_indices, indices) |*llvm_index, index| llvm_index.* = index.toLlvm(self); self.llvm.constants.appendAssumeCapacity(switch (kind) { - .normal => llvm.Type.constGEP, - .inbounds => llvm.Type.constInBoundsGEP, + .normal => &llvm.Type.constGEP, + .inbounds => &llvm.Type.constInBoundsGEP, }(ty.toLlvm(self), base.toLlvm(self), llvm_indices.ptr, @intCast(llvm_indices.len))); } } -- cgit v1.2.3