mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
riscv64: Handle writes to the zero register sensibly in result bookkeeping.
This commit is contained in:
parent
bf21e4f725
commit
199782edd1
1 changed files with 8 additions and 1 deletions
|
|
@ -1768,8 +1768,15 @@ fn finishAirBookkeeping(func: *Func) void {
|
||||||
fn finishAirResult(func: *Func, inst: Air.Inst.Index, result: MCValue) void {
|
fn finishAirResult(func: *Func, inst: Air.Inst.Index, result: MCValue) void {
|
||||||
if (func.liveness.isUnused(inst)) switch (result) {
|
if (func.liveness.isUnused(inst)) switch (result) {
|
||||||
.none, .dead, .unreach => {},
|
.none, .dead, .unreach => {},
|
||||||
else => unreachable, // Why didn't the result die?
|
// Why didn't the result die?
|
||||||
|
.register => |r| if (r != .zero) unreachable,
|
||||||
|
else => unreachable,
|
||||||
} else {
|
} else {
|
||||||
|
switch (result) {
|
||||||
|
.register => |r| if (r == .zero) unreachable, // Why did we discard a used result?
|
||||||
|
else => {},
|
||||||
|
}
|
||||||
|
|
||||||
tracking_log.debug("%{d} => {} (birth)", .{ inst, result });
|
tracking_log.debug("%{d} => {} (birth)", .{ inst, result });
|
||||||
func.inst_tracking.putAssumeCapacityNoClobber(inst, InstTracking.init(result));
|
func.inst_tracking.putAssumeCapacityNoClobber(inst, InstTracking.init(result));
|
||||||
// In some cases, an operand may be reused as the result.
|
// In some cases, an operand may be reused as the result.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue