mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Sema: Don't generate runtime instructions on zirSplat if dest_ty doesn't have runtime bits
This commit is contained in:
parent
efe06c5f31
commit
c3aa32e984
@ -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.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 operand = try sema.resolveInst(extra.rhs);
|
||||||
const scalar_ty = dest_ty.childType(mod);
|
const scalar_ty = dest_ty.childType(mod);
|
||||||
const scalar = try sema.coerce(block, scalar_ty, operand, scalar_src);
|
const scalar = try sema.coerce(block, scalar_ty, operand, scalar_src);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user