From 7355aa3e9e88b7236fc86226b50ce820c7ff5220 Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 9 Apr 2026 10:22:24 +0200 Subject: x86-64/isel: fix stack addr regression from 8b79b61ae7 Checks for RADDR should also look for RSTACK when fusing addresses --- src/t_x86-64_isel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/t_x86-64_isel.c') diff --git a/src/t_x86-64_isel.c b/src/t_x86-64_isel.c index f4e4523..0ad3834 100644 --- a/src/t_x86-64_isel.c +++ b/src/t_x86-64_isel.c @@ -81,7 +81,7 @@ Begin: uint ksiz = cls2siz[con->cls]; Type ctype; /* can't use memory arg in rhs if lhs is memory */ - bool docopy = ins && &ins->l != r && (oisstore(ins->op) || ins->l.t == RADDR); + bool docopy = ins && &ins->l != r && (oisstore(ins->op) || ins->l.t == RADDR || ins->l.t == RSTACK); if (con->cls <= KPTR && (in_range(op, Ocopy, Omove) || op == Ophi)) /* in this case we can use movabs */ return; @@ -268,6 +268,8 @@ aadd(IRAddr *out, Block *blk, int *curi, Ref r, bool recurring) const IRAddr *adr2 = &addrtab.p[ins->l.i]; adr = *adr2; goto Add2; + } else if (ins->op == Ocopy && ins->l.t == RSTACK && !out->base.bits) { + out->base = ins->l; } else if (ins->op == Oshl) { if (!ascale(out, ins->l, ins->r)) goto Ref; ins->skip = 1; @@ -327,7 +329,7 @@ addarg4addrp(Ref r) if (r.t == RSTACK) return 1; if (r.t != RTMP) return 0; ins = &instrtab[r.i]; - return (ins->op == Ocopy && ins->l.t == RADDR) || ins->op == Oadd || ins->op == Oshl; + return (ins->op == Ocopy && (ins->l.t == RADDR || ins->l.t == RSTACK)) || ins->op == Oadd || ins->op == Oshl; } static void -- cgit v1.2.3