Commit 6bee4e55 authored by Luuk van Dijk's avatar Luuk van Dijk

gc: avoid re-genning ninit in branches involving float comparison.

R=rsc
CC=golang-dev
https://golang.org/cl/5451050
parent c4d0ac0e
...@@ -850,6 +850,7 @@ bgen(Node *n, int true, Prog *to) ...@@ -850,6 +850,7 @@ bgen(Node *n, int true, Prog *to)
int et, a; int et, a;
Node *nl, *nr, *r; Node *nl, *nr, *r;
Node n1, n2, n3, n4, tmp; Node n1, n2, n3, n4, tmp;
NodeList *ll;
Prog *p1, *p2; Prog *p1, *p2;
USED(n4); // in unreachable code below USED(n4); // in unreachable code below
...@@ -950,7 +951,10 @@ bgen(Node *n, int true, Prog *to) ...@@ -950,7 +951,10 @@ bgen(Node *n, int true, Prog *to)
p1 = gbranch(AB, T); p1 = gbranch(AB, T);
p2 = gbranch(AB, T); p2 = gbranch(AB, T);
patch(p1, pc); patch(p1, pc);
ll = n->ninit;
n->ninit = nil;
bgen(n, 1, p2); bgen(n, 1, p2);
n->ninit = ll;
patch(gbranch(AB, T), to); patch(gbranch(AB, T), to);
patch(p2, pc); patch(p2, pc);
goto ret; goto ret;
......
...@@ -717,6 +717,7 @@ bgen(Node *n, int true, Prog *to) ...@@ -717,6 +717,7 @@ bgen(Node *n, int true, Prog *to)
int et, a; int et, a;
Node *nl, *nr, *l, *r; Node *nl, *nr, *l, *r;
Node n1, n2, tmp; Node n1, n2, tmp;
NodeList *ll;
Prog *p1, *p2; Prog *p1, *p2;
if(debug['g']) { if(debug['g']) {
...@@ -834,7 +835,10 @@ bgen(Node *n, int true, Prog *to) ...@@ -834,7 +835,10 @@ bgen(Node *n, int true, Prog *to)
p1 = gbranch(AJMP, T); p1 = gbranch(AJMP, T);
p2 = gbranch(AJMP, T); p2 = gbranch(AJMP, T);
patch(p1, pc); patch(p1, pc);
ll = n->ninit; // avoid re-genning ninit
n->ninit = nil;
bgen(n, 1, p2); bgen(n, 1, p2);
n->ninit = ll;
patch(gbranch(AJMP, T), to); patch(gbranch(AJMP, T), to);
patch(p2, pc); patch(p2, pc);
goto ret; goto ret;
......
...@@ -787,6 +787,7 @@ bgen(Node *n, int true, Prog *to) ...@@ -787,6 +787,7 @@ bgen(Node *n, int true, Prog *to)
int et, a; int et, a;
Node *nl, *nr, *r; Node *nl, *nr, *r;
Node n1, n2, tmp, t1, t2, ax; Node n1, n2, tmp, t1, t2, ax;
NodeList *ll;
Prog *p1, *p2; Prog *p1, *p2;
if(debug['g']) { if(debug['g']) {
...@@ -902,7 +903,10 @@ bgen(Node *n, int true, Prog *to) ...@@ -902,7 +903,10 @@ bgen(Node *n, int true, Prog *to)
p1 = gbranch(AJMP, T); p1 = gbranch(AJMP, T);
p2 = gbranch(AJMP, T); p2 = gbranch(AJMP, T);
patch(p1, pc); patch(p1, pc);
ll = n->ninit; // avoid re-genning ninit
n->ninit = nil;
bgen(n, 1, p2); bgen(n, 1, p2);
n->ninit = ll;
patch(gbranch(AJMP, T), to); patch(gbranch(AJMP, T), to);
patch(p2, pc); patch(p2, pc);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment