]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/9g: use nopout in excise
authorRuss Cox <rsc@golang.org>
Thu, 29 Jan 2015 01:44:55 +0000 (20:44 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 30 Jan 2015 02:49:52 +0000 (02:49 +0000)
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>
src/cmd/9g/gobj.c
src/cmd/9g/peep.c

index 3da55878a763c379845a2530e88e603309547ea4..cda0b0e7143d4cf3a812ef2cb4c04b067d92dfe0 100644 (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;
 }
-
index 4e636b14840fa6ed835840e3ab0ddb3f1ea955f4..11a6b591a220d535f2f3123974473a02d313e3fd 100644 (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++;
 }