[PATCH] doloop_optimize miscompiles openssl

Geoff Keating geoffk@cygnus.com
Sun Sep 24 22:25:00 GMT 2000


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?

-- 
- Geoffrey Keating <geoffk@cygnus.com>


More information about the Gcc-patches mailing list