From: Adrian Bunk <bunk@kernel.org>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>, linux-kernel@vger.kernel.org
Subject: Re: [RFC: 2.6 patch] add -fno-tree-scev-cprop to KBUILD_CFLAGS
Date: Tue, 13 Nov 2007 12:39:57 +0100 [thread overview]
Message-ID: <20071113113957.GB4250@stusta.de> (raw)
In-Reply-To: <20071112165843.GF5451@devserv.devel.redhat.com>
On Mon, Nov 12, 2007 at 11:58:43AM -0500, Jakub Jelinek wrote:
> On Sun, Nov 11, 2007 at 07:48:29AM +0100, Adrian Bunk wrote:
> > The gcc from svn that will become gcc 4.3 generates libgcc calls in
> > cases like the following (on 32bit architectures):
> >
> > <-- snip -->
> >
> > static inline void timespec_add_ns(struct timespec *a, u64 ns)
> > {
> > ...
> > while(ns >= NSEC_PER_SEC) {
> > ns -= NSEC_PER_SEC;
> > a->tv_sec++;
> > }
> > ...
> >
> > <-- snip -->
>
> Blindly using -fno-tree-scev-cprop just to get rid of one case where
> this turns out to be a pessimization when kernel knows ns is usually very
> small is IMHO a wrong thing, you'd lose many cases where this optimization
> can actually improve performance.
It's not about performance, it's about a build error.
> Instead, for this exact case just
> add an optimization barrier to avoid gcc doing this.
> Adding asm ("" : "=r" (ns) : "0" (ns)); (or hide it in some macro) into the
> loop will do the job just fine.
The problem is that this is very fragile - imagine what might happen
when a frequently used struct member gets changed from int to u64.
After all, when looking at current practice, the kernel will support
being built with gcc 4.3 until 2013 or 2014.
> Jakub
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
prev parent reply other threads:[~2007-11-13 11:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-11 6:48 [RFC: 2.6 patch] add -fno-tree-scev-cprop to KBUILD_CFLAGS Adrian Bunk
2007-11-11 7:34 ` Paul Mundt
2007-11-12 6:14 ` the kernel, gcc and libgcc Adrian Bunk
2007-11-12 16:24 ` [RFC: 2.6 patch] add -fno-tree-scev-cprop to KBUILD_CFLAGS Bernd Schmidt
2007-11-12 16:40 ` Adrian Bunk
2007-11-12 22:07 ` Bernd Schmidt
2007-11-13 6:04 ` Adrian Bunk
2007-11-12 16:58 ` Jakub Jelinek
2007-11-13 11:39 ` Adrian Bunk [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071113113957.GB4250@stusta.de \
--to=bunk@kernel.org \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox