This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] doloop_optimize miscompiles openssl


At 07:24 25.09.00, Geoff Keating wrote:

>Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:
>
> >       * doloop.c (doloop_modify): Prevent delete_insn() from
> >       deleting too much.  Prefer loop->top over loop->start as
> >       target for the new JUMP insn.
>
> > Index: gcc/doloop.c
> > ===================================================================
> > RCS file: /cvs/gcc/egcs/gcc/doloop.c,v
> > retrieving revision 1.2
> > diff -u -p -r1.2 doloop.c
> > --- doloop.c  2000/08/14 20:55:11     1.2
> > +++ doloop.c  2000/09/24 22:00:04
> > @@ -416,11 +416,14 @@ doloop_modify (loop, iterations, iterati
> >      }
> >
> >    /* Discard original jump to continue loop.  The original compare
> > -     result may still be live, so it cannot be discarded explicitly.  */
> > +     result may still be live, so it cannot be discarded explicitly.
> > +     Don't delete too much, increment the use count of the target 
> label.  */
> > +  LABEL_NUSES (JUMP_LABEL (jump_insn))++;
> >    delete_insn (jump_insn);
> > +  LABEL_NUSES (JUMP_LABEL (jump_insn))--;
> >
> > -  /* Emit the label that will delimit the start of the loop.  */
> > -  emit_label_after (start_label, loop->start);
> > +  /* Emit the label that will delimit the top of the loop.  */
> > +  emit_label_after (start_label, loop->top ? loop->top : loop->start);
> >    LABEL_NUSES (start_label)++;
>
>Franz,
>
>would it work to simply emit the start_label before calling
>delete_insn?  After all, the label that jump_insn branches to is
>really not used after this transformation, right?

Hmm, I think so... If delete_insn notices that the code is reachable from 
elsewhere, it should refrain from deleting it. I'll try it when I'm home.

Franz.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]