diff options
| author | 2026-04-11 22:49:19 +0200 | |
|---|---|---|
| committer | 2026-04-11 22:49:19 +0200 | |
| commit | d40371b615b560d8726fd4fdaf7d35abc959e0e9 (patch) | |
| tree | 6e302f213c3e44fecccc032e79ea9f2d13c5c177 /src/ir_simpl.c | |
| parent | 757b5735f44e9a9454f12612ec00c38d81f5f32c (diff) | |
backend: fix memory leak from not calling deluses() after replcuses in some places
Diffstat (limited to 'src/ir_simpl.c')
| -rw-r--r-- | src/ir_simpl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ir_simpl.c b/src/ir_simpl.c index 1a3eb76..4395c7d 100644 --- a/src/ir_simpl.c +++ b/src/ir_simpl.c @@ -91,6 +91,7 @@ doins(Instr *ins, Block *blk, int *curi) if (r.bits) { *ins = mkinstr0(Onop,0); replcuses(mkref(RTMP, ins - instrtab), r); + deluses(ins - instrtab); return 1; } } @@ -103,6 +104,7 @@ doins(Instr *ins, Block *blk, int *curi) Ref it = ins->l; *ins = mkinstr0(Onop,0); replcuses(mkref(RTMP, ins - instrtab), it); + deluses(ins - instrtab); return 1; } break; @@ -243,7 +245,7 @@ simpl(Function *fn) int phi = blk->phi.p[i]; /* delete trivial phis */ Ref *args = phitab.p[instrtab[phi].l.i], - same = *args; + same = *args; if (same.t == RTMP && instrtab[same.i].op == Ophi) goto Next; if (blk->npred > 1) for (int j = 1; j < blk->npred; ++j) { if (args[j].bits != same.bits) goto Next; |