linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Triplett <josh@freedesktop.org>,
	linux-sparse@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: sparse -Wptr-subtraction-blows: still needed?
Date: Wed, 2 May 2007 01:35:57 +0100	[thread overview]
Message-ID: <20070502003557.GK4095@ftp.linux.org.uk> (raw)
In-Reply-To: <alpine.LFD.0.98.0705011719520.3808@woody.linux-foundation.org>

On Tue, May 01, 2007 at 05:24:54PM -0700, Linus Torvalds wrote:
> The only thing that was gcc-specific about it is that gcc goes to some 
> extreme lengths to turn the constant-sized division into a sequence of 
> shifts/multiples/subtracts, and can often turn a division into something 
> like ten cheaper operations instead.
> 
> But that optimization was also what made gcc take such a long time if the 
> constant division is very common (ie a header file with an inline 
> function, whether that function is actually _used_ or not apparently 
> didn't matter to gcc)

There used to be a Dumb Algorithm(tm) in there - basically, gcc went through
all decompositions of constant it was multiplying at and it did it in the
dumbest way possible (== without keeping track of the things like "oh, we'd
already looked at the best way to multiply by 69, no need to redo that
again and again)").  _That_ is what blew the build time to hell for a while.
And yes, that particular idiocy got fixed (they added a moderately-sized
LRU of triplets <constant, price, best way to multiply on it>, which killed
recalculation from scratch for each pointer subtraction and got complexity
of dealing with individual subtraction into tolerable range).

That's separate from runtime issues, of course.

  reply	other threads:[~2007-05-02  0:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-01 21:08 sparse -Wptr-subtraction-blows: still needed? Josh Triplett
2007-05-01 21:43 ` Linus Torvalds
2007-05-01 23:59   ` Josh Triplett
2007-05-02  0:24     ` Linus Torvalds
2007-05-02  0:35       ` Al Viro [this message]
2007-05-02 12:02       ` Alan Cox
2007-05-02 13:19         ` Andi Kleen
2007-05-02  0:26     ` Al Viro
2007-05-02  0:02   ` Al Viro
2007-05-02  2:42   ` Dave Jones
2007-05-02 13:03     ` Andi Kleen

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=20070502003557.GK4095@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=josh@freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).