aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorAntonio Gomes <antoniospg100@gmail.com>2024-05-01 08:04:39 -0300
committerVeikka Tuominen <git@vexu.eu>2024-05-02 13:57:28 +0300
commit5571c03a5a20a088c269f03c71631137f1ca2c3c (patch)
treeb2624233d1e6ee7d78346be0a6ccd2bf38b1b266 /src/Sema.zig
parentd841f84b8b68ee37ccad5ce97b71ea99d2c63c6d (diff)
downloadzig-5571c03a5a20a088c269f03c71631137f1ca2c3c.tar.gz
zig-5571c03a5a20a088c269f03c71631137f1ca2c3c.zip
Sema: Don't generate runtime instructions on zirSplat if dest_ty doesn't have runtime bits
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 32c87e7a47..74cea620e3 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -24295,6 +24295,14 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I
if (!dest_ty.isVector(mod)) return sema.fail(block, src, "expected vector type, found '{}'", .{dest_ty.fmt(mod)});
+ if (!dest_ty.hasRuntimeBits(mod)) {
+ const empty_aggregate = try mod.intern(.{ .aggregate = .{
+ .ty = dest_ty.toIntern(),
+ .storage = .{ .elems = &[_]InternPool.Index{} },
+ } });
+ return Air.internedToRef(empty_aggregate);
+ }
+
const operand = try sema.resolveInst(extra.rhs);
const scalar_ty = dest_ty.childType(mod);
const scalar = try sema.coerce(block, scalar_ty, operand, scalar_src);