Skip to content

Commit 5571c03

Browse files
antoniospgVexu
authored andcommitted
Sema: Don't generate runtime instructions on zirSplat if dest_ty doesn't have runtime bits
1 parent d841f84 commit 5571c03

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Sema.zig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24295,6 +24295,14 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I
2429524295

2429624296
if (!dest_ty.isVector(mod)) return sema.fail(block, src, "expected vector type, found '{}'", .{dest_ty.fmt(mod)});
2429724297

24298+
if (!dest_ty.hasRuntimeBits(mod)) {
24299+
const empty_aggregate = try mod.intern(.{ .aggregate = .{
24300+
.ty = dest_ty.toIntern(),
24301+
.storage = .{ .elems = &[_]InternPool.Index{} },
24302+
} });
24303+
return Air.internedToRef(empty_aggregate);
24304+
}
24305+
2429824306
const operand = try sema.resolveInst(extra.rhs);
2429924307
const scalar_ty = dest_ty.childType(mod);
2430024308
const scalar = try sema.coerce(block, scalar_ty, operand, scalar_src);

0 commit comments

Comments
 (0)