Commit 6f09a7041e
Changed files (6)
src
arch
codegen
src/arch/aarch64/CodeGen.zig
@@ -655,6 +655,11 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
const air_tags = self.air.instructions.items(.tag);
for (body) |inst| {
+ // TODO: remove now-redundant isUnused calls from AIR handler functions
+ if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
+ continue;
+ }
+
const old_air_bookkeeping = self.air_bookkeeping;
try self.ensureProcessDeathCapacity(Liveness.bpi);
src/arch/arm/CodeGen.zig
@@ -639,6 +639,11 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
const air_tags = self.air.instructions.items(.tag);
for (body) |inst| {
+ // TODO: remove now-redundant isUnused calls from AIR handler functions
+ if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
+ continue;
+ }
+
const old_air_bookkeeping = self.air_bookkeeping;
try self.ensureProcessDeathCapacity(Liveness.bpi);
src/arch/riscv64/CodeGen.zig
@@ -473,6 +473,11 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
const air_tags = self.air.instructions.items(.tag);
for (body) |inst| {
+ // TODO: remove now-redundant isUnused calls from AIR handler functions
+ if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
+ continue;
+ }
+
const old_air_bookkeeping = self.air_bookkeeping;
try self.ensureProcessDeathCapacity(Liveness.bpi);
src/arch/sparc64/CodeGen.zig
@@ -489,6 +489,11 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
const air_tags = self.air.instructions.items(.tag);
for (body) |inst| {
+ // TODO: remove now-redundant isUnused calls from AIR handler functions
+ if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
+ continue;
+ }
+
const old_air_bookkeeping = self.air_bookkeeping;
try self.ensureProcessDeathCapacity(Liveness.bpi);
src/arch/x86_64/CodeGen.zig
@@ -905,6 +905,11 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
const air_tags = self.air.instructions.items(.tag);
for (body) |inst| {
+ // TODO: remove now-redundant isUnused calls from AIR handler functions
+ if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
+ continue;
+ }
+
const old_air_bookkeeping = self.air_bookkeeping;
try self.ensureProcessDeathCapacity(Liveness.bpi);
if (builtin.mode == .Debug) {
src/codegen/spirv.zig
@@ -1507,6 +1507,11 @@ pub const DeclGen = struct {
}
fn genInst(self: *DeclGen, inst: Air.Inst.Index) !void {
+ // TODO: remove now-redundant isUnused calls from AIR handler functions
+ if (self.liveness.isUnused(inst) and !self.air.mustLower(inst)) {
+ return;
+ }
+
const air_tags = self.air.instructions.items(.tag);
const maybe_result_id: ?IdRef = switch (air_tags[inst]) {
// zig fmt: off