mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
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.
This commit is contained in:
parent
51f6438e07
commit
7a85ad151d
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user