This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH IRA] update_equiv_regs fails to set EQUIV reg-note for pseudo with more than one definition
- From: "Yangfei (Felix)" <felix dot yang at huawei dot com>
- To: Jeff Law <law at redhat dot com>, Felix Yang <fei dot yang0953 at gmail dot com>, "GCC Patches" <gcc-patches at gcc dot gnu dot org>, "vmakarov at redhat dot com" <vmakarov at redhat dot com>
- Date: Tue, 23 Sep 2014 02:48:12 +0000
- Subject: Re: [PATCH IRA] update_equiv_regs fails to set EQUIV reg-note for pseudo with more than one definition
- Authentication-results: sourceware.org; auth=none
- References: <CAFc0fxz3Fdr9rgLscjTzZm0PoBn53y028tQU4=U0BXQ0kY6+KA at mail dot gmail dot com> <54206D2C dot 708 at redhat dot com>
> On 09/22/14 08:40, Felix Yang wrote:
> > Hi,
> >
> > I find that update_equiv_regs in ira.c sets the wrong EQUIV
> > reg-note for pseudo with more than one definiton in certain situation.
> > Here is a simplified RTL snippet after this function finishs handling:
> >
> > (insn 77 37 78 2 (set (reg:SI 171)
> > (const_int 0 [0])) ticket151.c:33 52 {movsi_internal_dsp}
> > (expr_list:REG_EQUAL (const_int 0 [0])
> > (nil)))
> >
> > ......
> >
> > (insn 79 50 53 2 (set (mem/c:SI (reg/f:SI 136) [2 g_728+0 S4 A64])
> > (reg:SI 171)) ticket151.c:33 52 {movsi_internal_dsp}
> > (expr_list:REG_DEAD (reg:SI 171)
> > (nil)))
> > (insn 53 79 54 2 (set (mem/c:SI (reg/f:SI 162) [4 g_163+0 S4 A32])
> > (reg:SI 163)) 52 {movsi_internal_dsp}
> > (expr_list:REG_DEAD (reg:SI 163)
> > (expr_list:REG_DEAD (reg/f:SI 162)
> > (nil))))
> > (insn 54 53 14 2 (set (reg:SI 171)
> > (mem/u/c:SI (symbol_ref/u:SI ("*.LC8") [flags 0x2]) [4 S4
> > A32])) ticket151.c:49 52 {movsi_internal_dsp}
> > (expr_list:REG_EQUIV (mem/u/c:SI (symbol_ref/u:SI ("*.LC8")
> > [flags 0x2]) [4 S4 A32])
> > (expr_list:REG_EQUAL (mem/u/c:SI (symbol_ref/u:SI ("*.LC8")
> > [flags 0x2]) [4 S4 A32])
> > (nil))))
> >
> >
> > The REG_EQUIV of insn 54 is not correct as pseudo 171 is defined
> > in insn 77 with a differerent value.
> > This may causes reload replacing pseudo 171 with mem/u/c:SI
> > (symbol_ref/u:SI ("*.LC8"), which is wrong.
> > A proposed patch for this issue, please comment:
> Is it possible it's the conditional just above this one that is incorrect?
>
> if (DF_REG_DEF_COUNT (regno) != 1
> && (! note
> || rtx_varies_p (XEXP (note, 0), 0)
> || (reg_equiv[regno].replacement
> && ! rtx_equal_p (XEXP (note, 0),
>
> reg_equiv[regno].replacement))))
> {
> no_equiv (dest, set, NULL);
> continue;
> }
>
>
> ISTM the only time a multiply-set register can have a valid REG_EQUIV note is if
> each and every assignment to that pseudo has the same RHS.
>
> Jeff
Thanks Jeff. Yes, I agree that this is a better place to consider. I am thinking of a better way to fix this.
Vladimir, can you shed light on this and give me some suggestions? Thank you.