This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: Fix PR tree-optimization/25809


> On 4/16/07, H. J. Lu <hjl@lucon.org> wrote:
> > On Mon, Apr 16, 2007 at 10:02:52AM -0700, Daniel Berlin wrote:
> > > In PR 25809, it was requested that PRE perform cast motion to move
> > > invariant casts out of loops, apparently to help vectorization and
> > > other things.
> > >
> > > This patch does that.
> > >
> > > I have no idea whether it helps or hurts SPEC. If someone tells me
> > > this ends up not being a win, i'm happy to revert it and mark the bug
> > > WONTFIX :)
> > >
> > > Bootstrapped and regtested on i686-darwin.
> > >
> > > Committed to mainline.
> >
> > I didn't see it on mainline.
> >
>
> Yah, my i686-pc-linux-gnu bootstrap and regtest finished after my
> darwin one, and *does* show regressions in ability to vectorize
>
> So i'm not going to commit it.

Looks like with this patch PRE is placing casts in the latch block, which
is why the vectorizer refuses to vectorize:

  # ivtmp.36_45 = PHI <ivtmp.36_1(4), 16(2)>
  # prephitmp.28_23 = PHI <pretmp.27_42(4), 2(2)>
  # diff_50 = PHI <diff_21(4), 2(2)>
  # i_47 = PHI <i_22(4), 0(2)>
<L0>:;
  D.2503_13 = b[i_47];
  D.2504_14 = (unsigned char) D.2503_13;
  D.2505_16 = c[i_47];
  D.2506_17 = (unsigned char) D.2505_16;
  diff.6_19 = prephitmp.28_23;
  D.2507_18 = D.2504_14 + prephitmp.28_23;
  D.2509_20 = D.2507_18 - D.2506_17;
  i_22 = i_47 + 1;
  ivtmp.36_1 = ivtmp.36_45 - 1;
  if (ivtmp.36_1 != 0) goto <L27>; else goto <L28>;

<L27>:;
  diff_21 = (signed char) D.2509_20;
  pretmp.27_42 = (unsigned char) diff_21;
  goto <bb 3> (<L0>);


(without the patch:

  # ivtmp.36_5 = PHI <ivtmp.36_50(4), 16(2)>
  # i_54 = PHI <i_22(4), 0(2)>
  # diff_51 = PHI <diff_21(4), 2(2)>
<L0>:;
  D.2497_13 = b[i_54];
  D.2498_14 = (unsigned char) D.2497_13;
  D.2499_16 = c[i_54];
  D.2500_17 = (unsigned char) D.2499_16;
  diff.6_19 = (unsigned char) diff_51;
  D.2501_18 = D.2498_14 + diff.6_19;
  D.2503_20 = D.2501_18 - D.2500_17;
  diff_21 = (signed char) D.2503_20;
  i_22 = i_54 + 1;
  ivtmp.36_50 = ivtmp.36_5 - 1;
  if (ivtmp.36_50 != 0) goto <L25>; else goto <L26>;

<L25>:;
  goto <bb 3> (<L0>);
)

just FYI.

thanks for looking into this,

dorit


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