This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] pr36753, fwprop interacts badly with global register variable
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Paolo Bonzini" <bonzini at gnu dot org>
- Cc: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 17 Jul 2008 10:16:29 +0200
- Subject: Re: [PATCH] pr36753, fwprop interacts badly with global register variable
- References: <487EE09E.7070104@gnu.org>
On Thu, Jul 17, 2008 at 8:03 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
> Global register are live on entry, so accesses before a definition are not
> uninitialized.
>
> Tested i686-pc-linux-gnu, ok for mainline?
Ok. Ok also for the 4.3 branch if it is a regression and broken there
(ISTR it is).
Richard.
> Paolo
>
> 2008-07-17 Paolo Bonzini <bonzini@gnu.org>
>
> * fwprop.c (use_killed_between): Don't shortcut
> single-definition global registers.
>
> Index: ../../peak-gcc-src/gcc/fwprop.c
> ===================================================================
> --- ../../peak-gcc-src/gcc/fwprop.c (revision 136756)
> +++ ../../peak-gcc-src/gcc/fwprop.c (working copy)
> @@ -480,10 +480,15 @@ use_killed_between (struct df_ref *use,
> return true;
>
> /* Check if the reg in USE has only one definition. We already
> - know that this definition reaches use, or we wouldn't be here. */
> + know that this definition reaches use, or we wouldn't be here.
> + However, this is not true for hard registers, because if they are
> + live at the beginning of the function it does not mean that we
> + have an uninitialized access. */
> regno = DF_REF_REGNO (use);
> def = DF_REG_DEF_CHAIN (regno);
> - if (def && (def->next_reg == NULL))
> + if (def
> + && (def->next_reg == NULL)
> + && regno >= FIRST_PSEUDO_REGISTER)
> return false;
>
> /* Check locally if we are in the same basic block. */
>