From: ceriel Date: Fri, 24 Apr 1992 12:39:58 +0000 (+0000) Subject: Fixed problem with repl_mul(); it was called far too often X-Git-Tag: release-5-5~485 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=bc42e31518dd8798ea226bb64122a266bbf3f109;p=ack.git Fixed problem with repl_mul(); it was called far too often --- diff --git a/util/opt/patterns b/util/opt/patterns index 46bd1f495..4955fed12 100644 --- a/util/opt/patterns +++ b/util/opt/patterns @@ -32,6 +32,7 @@ adp sti $1!=0 && $2==w: stf $1 adp sti $1!=0 && $2==2*w: sdf $1 asp $1==0: asp asp : asp $1+$2 +dup asp $1<=$2: asp $2-$1 blm $1==0 : asp 2*p cmi zeq $1==w: beq $2 cmi zge $1==w: bge $2 diff --git a/util/opt/peephole.c b/util/opt/peephole.c index 4c07bd209..d7513deb2 100644 --- a/util/opt/peephole.c +++ b/util/opt/peephole.c @@ -655,9 +655,17 @@ basicblock(alpp) line_p *alpp; { lpp = next; } lpp = alpp; - if (repl_muls) while ((*lpp) != (line_p) 0) { + if (repl_muls) { + while ((lp = *lpp) != (line_p) 0 && (lp->l_instr&BMASK) != op_lab) { line_p b_repl, e_repl; - int cnt = repl_mul(*lpp, &b_repl, &e_repl); + int cnt; + + if ((cnt = (lp->l_instr & BMASK)) != op_loc && cnt != op_ldc) { + lpp = &lp->l_next; + continue; + } + + cnt = repl_mul(lp, &b_repl, &e_repl); lp = *lpp; if (cnt > 0 && cnt <= repl_muls) { @@ -677,6 +685,7 @@ basicblock(alpp) line_p *alpp; { } lpp = &lp->l_next; } + } } return madeopt; } @@ -698,9 +707,6 @@ repl_mul(lp, b, e) if ((ins = (next->l_instr & BMASK)) != op_mli && ins != op_mlu) { return 0; } - if ((ins = (lp->l_instr & BMASK)) != op_loc && ins != op_ldc) { - return 0; - } switch(next->l_optyp) { case OPNO: return 0;