This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: optimization removes a __builtin_memcpy?
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: Richard Guenther <richard dot guenther at gmail dot com>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Mon, 1 Dec 2008 06:44:48 -0800
- Subject: Re: optimization removes a __builtin_memcpy?
- References: <20081130042805.GA64990@troutmask.apl.washington.edu> <84fc9c000811300326t18f0b203oa7c9be67787ebece@mail.gmail.com> <339c37f20811301056i3e9995ffxae48867a275c2dfc@mail.gmail.com>
On Sun, Nov 30, 2008 at 07:56:51PM +0100, Paul Richard Thomas wrote:
> Dear Richard,
>
> >> The diff shows that the fails case correctly has dlen=30
> >> and in fact for any value less than slen=44 and -O[123]
> >> removes the __builtin_memcpy(). So what is missing or
> >> how to I inhibit this optimization?
> >
> > You cannot inhibit this optimization, instead the optimization should be
> > fixed to not generate invalid gimple ;) (see builtins.c:fold_builtin_memory_op)
> >
>
> Your comment is a bit opaque, to me at least:-) I looked at
> builtins.c:fold_builtin_memory_op and figured out that if dest or src
> are not pointer types the call does not get inlined. Does this
> matter?
>
> Steve, does the code work?
>
I have a working patch. Unfortunately, I had to move my trip
to Washington DC up by a day, so was sitting on an airplane
for 5 hours yesterday. I'll submit a patch sometime this
week.
Richard's comment helped to the extent that I read through
trans.c with a bit more care. In the end, telling someone
with my background to look at builtins.c:fold_builtin_memory_op
is tantamount to telling a blind person to look at a Picasso.
--
Steve