summaryrefslogtreecommitdiff
path: root/src/cmd/8g/peep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/8g/peep.c')
-rw-r--r--src/cmd/8g/peep.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/cmd/8g/peep.c b/src/cmd/8g/peep.c
index 966c0421b..a4e516dd3 100644
--- a/src/cmd/8g/peep.c
+++ b/src/cmd/8g/peep.c
@@ -107,7 +107,7 @@ peep(Prog *firstp)
switch(p->as) {
case ALEAL:
if(regtyp(&p->to))
- if(p->from.sym != S)
+ if(p->from.sym != nil)
if(p->from.index == D_NONE || p->from.index == D_CONST)
conprop(r);
break;
@@ -387,6 +387,8 @@ subprop(Flow *r0)
if(uniqs(r) == nil)
break;
p = r->prog;
+ if(p->as == AVARDEF || p->as == AVARKILL)
+ continue;
proginfo(&info, p);
if(info.flags & Call)
return 0;
@@ -478,7 +480,7 @@ copy1(Adr *v1, Adr *v2, Flow *r, int f)
if(debug['P'])
print("; merge; f=%d", f);
}
- t = copyu(p, v2, A);
+ t = copyu(p, v2, nil);
switch(t) {
case 2: /* rar, can't split */
if(debug['P'])
@@ -516,7 +518,7 @@ copy1(Adr *v1, Adr *v2, Flow *r, int f)
break;
}
if(!f) {
- t = copyu(p, v1, A);
+ t = copyu(p, v1, nil);
if(!f && (t == 2 || t == 3 || t == 4)) {
f = 1;
if(debug['P'])
@@ -547,7 +549,7 @@ copyu(Prog *p, Adr *v, Adr *s)
switch(p->as) {
case AJMP:
- if(s != A) {
+ if(s != nil) {
if(copysub(&p->to, v, s, 1))
return 1;
return 0;
@@ -557,7 +559,7 @@ copyu(Prog *p, Adr *v, Adr *s)
return 0;
case ARET:
- if(s != A)
+ if(s != nil)
return 1;
return 3;
@@ -569,7 +571,7 @@ copyu(Prog *p, Adr *v, Adr *s)
if(v->type == p->from.type)
return 2;
- if(s != A) {
+ if(s != nil) {
if(copysub(&p->to, v, s, 1))
return 1;
return 0;
@@ -584,6 +586,8 @@ copyu(Prog *p, Adr *v, Adr *s)
return 0;
}
+ if(p->as == AVARDEF || p->as == AVARKILL)
+ return 0;
proginfo(&info, p);
if((info.reguse|info.regset) & RtoB(v->type))
@@ -599,7 +603,7 @@ copyu(Prog *p, Adr *v, Adr *s)
if(info.flags & RightWrite) {
if(copyas(&p->to, v)) {
- if(s != A)
+ if(s != nil)
return copysub(&p->from, v, s, 1);
if(copyau(&p->from, v))
return 4;
@@ -608,7 +612,7 @@ copyu(Prog *p, Adr *v, Adr *s)
}
if(info.flags & (LeftAddr|LeftRead|LeftWrite|RightAddr|RightRead|RightWrite)) {
- if(s != A) {
+ if(s != nil) {
if(copysub(&p->from, v, s, 1))
return 1;
return copysub(&p->to, v, s, 1);
@@ -727,7 +731,7 @@ loop:
return;
p = r->prog;
- t = copyu(p, v0, A);
+ t = copyu(p, v0, nil);
switch(t) {
case 0: // miss
case 1: // use
@@ -743,7 +747,7 @@ loop:
if(p->from.node == p0->from.node)
if(p->from.offset == p0->from.offset)
if(p->from.scale == p0->from.scale)
- if(p->from.u.vval == p0->from.u.vval)
+ if(p->from.type == D_FCONST && p->from.u.dval == p0->from.u.dval)
if(p->from.index == p0->from.index) {
excise(r);
goto loop;