diff options
| author | WormHeamer | 2025-08-07 04:20:47 -0400 |
|---|---|---|
| committer | WormHeamer | 2025-08-07 04:20:47 -0400 |
| commit | 9c8861a1ad58954f40d599c83405c720e0d2e07b (patch) | |
| tree | 0e32a2007a3e5e130ba910d8d06d8d6d4c2930c6 /ir.c | |
| parent | 739b4852d2a826ba2985c7db2f5c778050f72250 (diff) | |
fix region nodes being culled prematurely
Diffstat (limited to 'ir.c')
| -rw-r--r-- | ir.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -60,6 +60,7 @@ Str type_desc(Type *t, Arena *arena) { case T_TUPLE: return S("tuple"); case T_BOOL: return S("bool"); case T_INT: return S("i64"); + case T_PTR: return str_fmt(arena, "^%S", type_desc(t->next, arena)); default: return S("N/A"); } } @@ -712,12 +713,12 @@ zero_no_effect: if (node_eql_i64(CAR(n), 0)) return CDR(n); case N_PHI: if (same) return CAR(n); - if (IN(CTRL(n), 0)->val.type.lvl == T_XCTRL) { - return CDR(n); - } if (IN(CTRL(n), 1)->val.type.lvl == T_XCTRL) { return CAR(n); } + if (IN(CTRL(n), 0)->val.type.lvl == T_XCTRL) { + return CDR(n); + } break; default: @@ -854,12 +855,11 @@ NameBinding *scope_bind(Scope *scope, Str name, Node *value, LexSpan pos, Proc * return prev; } -NameBinding *scope_update(Scope *scope, Str name, Node *to, Proc *proc) { - NameBinding *b = scope_find(scope, name); - if (!b) return NULL; +NameBinding *scope_update(NameBinding *b, Node *to, Proc *proc) { + Node *n = b->node; node_add(proc, to, proc->keepalive); - node_remove(proc, b->node, proc->keepalive); b->node = to; + node_remove(proc, n, proc->keepalive); return b; } |
