From b826bf418330b9b13a26195ee541e9e7fd9e77ac Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 4 Jan 2026 08:58:04 +0100 Subject: rega: fix spill copy of i32 -> i64 --- ir/regalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ir/regalloc.c') diff --git a/ir/regalloc.c b/ir/regalloc.c index 39a3f74..14dfafc 100644 --- a/ir/regalloc.c +++ b/ir/regalloc.c @@ -1074,16 +1074,16 @@ devirt(struct rega *ra, struct block *blk) int tr; if (r->t == RTMP) { alloc = (it = &ra->intervals.temps[r->i]) && it->nrange ? &it->alloc : NULL; - if (alloc && alloc->t == ASTACK && ins->op == Omove) { + if (alloc && alloc->t == ASTACK && ins->op == Omove && kisint(ins->cls) == kisint(instrtab[r->i].cls)) { /* move [reg], [stk] -> [reg] = load [stk] */ assert(r == &ins->r && ins->l.t == RREG); ins->reg = ins->l.i+1; - ins->op = cls2load[ins->cls]; + ins->op = cls2load[instrtab[r->i].cls]; ins->r = NOREF; addstkslotref(temp, alloc->a*8); - } else if (alloc && alloc->t == ASTACK && ins->op == Ocopy && r == &ins->l && ins->reg) { + } else if (alloc && alloc->t == ASTACK && ins->op == Ocopy && r == &ins->l && ins->reg && kisint(ins->cls) == kisint(instrtab[r->i].cls)) { /* [reg] = copy [stk] -> [reg] = load [stk] */ - ins->op = cls2load[ins->cls]; + ins->op = cls2load[instrtab[r->i].cls]; addstkslotref(temp, alloc->a*8); } else if (alloc && alloc->t == ASTACK) { /* ref was spilled, gen load to scratch register and use it */ -- cgit v1.2.3