This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: A case that PRE optimization hurts performance
- From: "Jiangning Liu" <jiangning dot liu at arm dot com>
- To: "'Richard Guenther'" <richard dot guenther at gmail dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Mon, 26 Sep 2011 15:39:29 +0800
- Subject: RE: A case that PRE optimization hurts performance
- References: <4e3762ed.030d440a.1143.2af2SMTPIN_ADDED@mx.google.com> <CAFiYyc0KyF4unL8hurQ77=rArSrxonFzz_MGKZDLZ=rSYZ__DQ@mail.gmail.com> <4e72add8.c9d0e30a.142a.ffffe60eSMTPIN_ADDED@mx.google.com> <CAFiYyc0dfbp_qJCueUj-aNKfF4=8SxshE7_eDZED9i1DF5GNwg@mail.gmail.com>
> > * Without PRE,
> >
> > Path1:
> > ? ? ? ?movl ? ?$2, %eax
> > ? ? ? ?cmpl ? ?$1, %eax
> > ? ? ? ?je ? ? ?.L3
> >
> > Path2:
> > ? ? ? ?movb ? ?$3, %al
> > ? ? ? ?cmpl ? ?$1, %eax
> > ? ? ? ?je ? ? ?.L3
> >
> > Path3:
> > ? ? ? ?cmpl ? ?$1, %eax
> > ? ? ? ?jne ? ? .L14
> >
> > * With PRE,
> >
> > Path1:
> > ? ? ? ?movl ? ?$1, %ebx
> > ? ? ? ?movl ? ?$2, %eax
> > ? ? ? ?testb ? %bl, %bl
> > ? ? ? ?je ? ? ?.L3
> >
> > Path2:
> > ? ? ? ?movl ? ?$1, %ebx
> > ? ? ? ?movb ? ?$3, %al
> > ? ? ? ?testb ? %bl, %bl
> > ? ? ? ?je ? ? ?.L3
> >
> > Path3:
> > ? ? ? ?cmpl ? ?$1, %eax
> > ? ? ? ?setne ? %bl
> > ? ? ? ?testb ? %bl, %bl
> > ? ? ? ?jne ? ? .L14
> >
> > Do you have any more thoughts?
>
> It seems to me that with PRE all the testb %bl, %bl
> should be evaluated at compile-time considering the
> preceeding movl $1, %ebx. Am I missing something?
>
Yes. Can this be done by PRE or any other optimizations in middle end?
Thanks,
-Jiangning
> Richard.
>