authorgravatar for cupertinorp@gmail.comRahul Prabhu <cupertinorp@gmail.com> 2024-01-21 22:45:03+05:30
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-23 18:32:34-08:00
log2ab78937dd29fbc299ac434f962a5ff41002cc43
tree73b4505fa623adbcb53b4c47b4925752c3599c41
parenteff58d6c18de66cbf0c0dbd7c3ced9ef9ffbcde6

Don't assume a write if an operand is not in function parameters

Liveness assumes that if the operand is not in the parameters of a function call it is being written to, resulting in pointless memcpies.

1 files changed, 2 insertions(+), 2 deletions(-)

src/Liveness.zig+2-2
...@@ -489,7 +489,7 @@ pub fn categorizeOperand(...@@ -489,7 +489,7 @@ pub fn categorizeOperand(
489 for (args, 0..) |arg, i| {489 for (args, 0..) |arg, i| {
490 if (arg == operand_ref) return matchOperandSmallIndex(l, inst, @as(OperandInt, @intCast(i + 1)), .write);490 if (arg == operand_ref) return matchOperandSmallIndex(l, inst, @as(OperandInt, @intCast(i + 1)), .write);
491 }491 }
492 return .write;492 return .none;
493 }493 }
494 var bt = l.iterateBigTomb(inst);494 var bt = l.iterateBigTomb(inst);
495 if (bt.feed()) {495 if (bt.feed()) {
...@@ -504,7 +504,7 @@ pub fn categorizeOperand(...@@ -504,7 +504,7 @@ pub fn categorizeOperand(
504 if (arg == operand_ref) return .write;504 if (arg == operand_ref) return .write;
505 }505 }
506 }506 }
507 return .write;507 return .none;
508 },508 },
509 .select => {509 .select => {
510 const pl_op = air_datas[@intFromEnum(inst)].pl_op;510 const pl_op = air_datas[@intFromEnum(inst)].pl_op;