On Mon, Apr 13, 2020 at 8:48 AM xiezhiheng <xiezhih...@huawei.com> wrote: > > Ping for: > <https://gcc.gnu.org/pipermail/gcc-patches/2020-April/543102.html>
This is definitely stage1 material. Richard. > Xie Zhiheng > > > > -----Original Message----- > > From: xiezhiheng > > Sent: Thursday, April 2, 2020 2:35 PM > > To: 'gcc-patches@gcc.gnu.org' <gcc-patches@gcc.gnu.org> > > Subject: [PATCH PR94442] [AArch64] Redundant ldp/stp instructions emitted > > at -O3 > > > > Hi, > > I've created a bug for this issue: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94442 > > > > And I'm going to solve this problem by propagating def's insn to its use > > when they are at the same loop in fwprop pass. > > I mean something like: > > diff --git a/gcc/fwprop.c b/gcc/fwprop.c > > index 705d2885aae..0edbbc65047 100644 > > --- a/gcc/fwprop.c > > +++ b/gcc/fwprop.c > > @@ -416,7 +416,7 @@ should_replace_address (rtx old_rtx, rtx new_rtx, > > machine_mode mode, > > gain = (set_src_cost (new_rtx, VOIDmode, speed) > > - set_src_cost (old_rtx, VOIDmode, speed)); > > > > - return (gain > 0); > > + return (gain >= 0); > > } > > > > > > @@ -1573,10 +1573,14 @@ fwprop (bool fwprop_addr_p) > > df_ref use = DF_USES_GET (i); > > if (use) > > { > > + df_ref def = get_def_for_use (use); > > if (DF_REF_TYPE (use) == DF_REF_REG_USE > > || DF_REF_BB (use)->loop_father == NULL > > /* The outer most loop is not really a loop. */ > > - || loop_outer (DF_REF_BB (use)->loop_father) == NULL) > > + || loop_outer (DF_REF_BB (use)->loop_father) == NULL > > + || (def && (DF_REF_BB (def)->loop_father == DF_REF_BB > > (use)->loop_father > > + || flow_loop_nested_p > > (DF_REF_BB(use)->loop_father, > > + > > DF_REF_BB(def)->loop_father)))) > > forward_propagate_into (use, fwprop_addr_p); > > > > else if (fwprop_addr_p) > > > > Any suggestions? > > > > Best regards > > Xie Zhiheng