Fix the completely bogus handling of "x" in dag creation.

That made a complete mashup of attached identifiers :P
This commit is contained in:
Bill Currie 2012-07-17 14:03:04 +09:00
parent 24553867a4
commit 39506881c0

View file

@ -231,7 +231,7 @@ make_dag (const sblock_t *block)
for (s = block->statements; s; s = s->next) { for (s = block->statements; s; s = s->next) {
operand_t *x = 0, *y = 0, *z = 0, *w = 0; operand_t *x = 0, *y = 0, *z = 0, *w = 0;
dagnode_t *n = 0, *nx, *ny, *nz, *nw; dagnode_t *n = 0, *nx, *ny, *nz, *nw;
daglabel_t *op; daglabel_t *op, *lx;
int simp; int simp;
simp = find_operands (s, &x, &y, &z, &w); simp = find_operands (s, &x, &y, &z, &w);
@ -258,22 +258,21 @@ make_dag (const sblock_t *block)
n->next = dagnodes; n->next = dagnodes;
dagnodes = n; dagnodes = n;
} }
lx = operand_label (x);
if ((nx = node (x))) { if ((nx = node (x))) {
daglabel_t **l; daglabel_t **l;
for (l = &nx->identifiers; *l; l = &(*l)->next) { for (l = &nx->identifiers; *l; l = &(*l)->next) {
if (*l == nx->label) { if (*l == lx) {
*l = (*l)->next; *l = (*l)->next;
nx->label->next = 0; lx->next = 0;
break; break;
} }
} }
} else {
nx = leaf_node (x);
} }
if (nx) { if (lx) {
nx->label->next = n->identifiers; lx->next = n->identifiers;
n->identifiers = nx->label; n->identifiers = lx;
nx->label->dagnode = n; lx->dagnode = n;
} }
dag = n; dag = n;
// c = a * b // c = a * b