ref: fb96623fc6a1919d7c1551b2a3e13f73265034b4
parent: d9bc0a023ad88e2a8848db1c0577c224c1b00fa3
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Mar 20 23:02:07 EDT 2015
Fix moveto() reuse case When moveto detects that register already contents the symbol we are looking for it has to return. Is is not the same and it is not used, then it must be spilled.
--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -158,9 +158,9 @@
if (u) {
Symbol *sym = np->sym;
- if (op == u->op && sym && sym == u->sym)
+ if (sym && sym == u->sym)
return;
- else
+ else if (!np->used)
spill(reg);
}
@@ -349,6 +349,7 @@
lp->used = 1;
np->op = REG;
np->reg = rp->reg;
+ np->sym = lp->sym;
}
static void