diff options
| author | 2026-04-09 10:22:24 +0200 | |
|---|---|---|
| committer | 2026-04-09 10:24:07 +0200 | |
| commit | 7355aa3e9e88b7236fc86226b50ce820c7ff5220 (patch) | |
| tree | 5e25f4e0cd641ae5c28038ca5ceb584db31ca3db /src | |
| parent | 53c789eb351e0281026d7145dc6dbc83338d7aa8 (diff) | |
x86-64/isel: fix stack addr regression from 8b79b61ae7
Checks for RADDR should also look for RSTACK when fusing addresses
Diffstat (limited to 'src')
| -rw-r--r-- | src/t_x86-64_isel.c | 6 |
1 files changed, 4 insertions, 2 deletions
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 |