cmd/9g: use nopout in excise

In addition to duplicating the logic, the old code was
clearing the line number, which led to missing source line
information in the -S output.

Also fix nopout, which was incomplete.

Change-Id: Ic2b596a2f9ec2fe85642ebe125cca8ef38c83085
Reviewed-on: https://go-review.googlesource.com/3512
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
This commit is contained in:
Russ Cox 2015-01-28 20:44:55 -05:00
parent 925861f306
commit 1d0664ef0d
2 changed files with 6 additions and 6 deletions

View File

@ -236,5 +236,8 @@ void
nopout(Prog *p)
{
p->as = ANOP;
p->from = zprog.from;
p->from3 = zprog.from3;
p->reg = zprog.reg;
p->to = zprog.to;
}

View File

@ -327,15 +327,12 @@ ret:
void
excise(Flow *r)
{
Prog *p, *l;
Prog *p;
p = r->prog;
if(debug['P'] && debug['v'])
print("%P ===delete===\n", p);
l = p->link;
*p = zprog;
p->as = ANOP;
p->link = l;
nopout(p);
ostats.ndelmov++;
}