Skip to content

Commit

Permalink
Sema: Don't generate runtime instructions on zirSplat if dest_ty does…
Browse files Browse the repository at this point in the history
…n't have runtime bits
  • Loading branch information
antoniospg authored and Vexu committed May 2, 2024
1 parent d841f84 commit 5571c03
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Sema.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5571c03

Please sign in to comment.