From 14bac1ffcf044c01362776cceb9ff8d381285fd4 Mon Sep 17 00:00:00 2001 From: xtex Date: Sun, 30 Aug 2026 20:31:11 +0800 Subject: [PATCH] loongarch: protect result register in cmp --- src/codegen/loongarch/Select.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/codegen/loongarch/Select.zig b/src/codegen/loongarch/Select.zig index cb5ede9cceb7119eeb456ce59a774f9e493a7850..8caf7098b3a0fcab38431635037465f81f43300f 100644 --- a/src/codegen/loongarch/Select.zig +++ b/src/codegen/loongarch/Select.zig @@ -5948,6 +5948,9 @@ fn cmp( rhs_vi: Value.Index, ) !void { wip_mir_log.debug(" | # cmp {f}, {t}, {f}, {t}, {f}", .{ isel.fmtType(ty), res_reg, lhs_vi, op, rhs_vi }); + const res_lock = isel.tryLockReg(res_reg); + defer res_lock.unlock(isel); + if (!ty.isRuntimeFloat() and !ty.isArrayOrVector(isel.pt.zcu)) { // integeral comparison const int_info: std.builtin.Type.Int = if (ty.toIntern() == .bool_type) -- 2.54.0