From owner-freebsd-stable@FreeBSD.ORG Thu Sep 14 05:23:22 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 54B3E16A407 for ; Thu, 14 Sep 2006 05:23:22 +0000 (UTC) (envelope-from kline@sage.thought.org) Received: from sage.thought.org (dsl231-043-140.sea1.dsl.speakeasy.net [216.231.43.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id AF80743D6D for ; Thu, 14 Sep 2006 05:23:20 +0000 (GMT) (envelope-from kline@sage.thought.org) Received: from sage.thought.org (kline@localhost [127.0.0.1]) by sage.thought.org (8.13.6/8.12.10) with ESMTP id k8E5NJKs094210; Wed, 13 Sep 2006 22:23:19 -0700 (PDT) (envelope-from kline@sage.thought.org) Received: (from kline@localhost) by sage.thought.org (8.13.6/8.13.1/Submit) id k8E5NIOW094209; Wed, 13 Sep 2006 22:23:18 -0700 (PDT) (envelope-from kline) Date: Wed, 13 Sep 2006 22:23:18 -0700 From: Gary Kline To: Mark Andrews Message-ID: <20060914052318.GC92358@thought.org> References: <20060913234934.GA92067@thought.org> <200609140002.k8E02b11073990@drugs.dv.isc.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200609140002.k8E02b11073990@drugs.dv.isc.org> X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: Observing twenty years of service to the Unix community User-Agent: Mutt/1.5.11 Cc: Gary Kline , freebsd-stable@freebsd.org, Stefan Lambrev Subject: Re: optimization levels for 6-STABLE build{kernel,world} X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2006 05:23:22 -0000 On Thu, Sep 14, 2006 at 10:02:37AM +1000, Mark Andrews wrote: > > > On Wed, Sep 13, 2006 at 12:17:15PM +0300, Stefan Lambrev wrote: > > > Hello, > > > > > > Oliver Fromme wrote: > > > >Marc G. Fournier wrote: > > > > > What are ppl currently using for CFLAGS/COPTFLAGS in /etc/make.conf for > > > > > > > building kernel/world? I know awhile back it wasn't recommended to go > > > > > above -O2, for instance, but suspect that has changed ... ? > > > > > > > >The best optimization is probably to not override the > > > >defaults at all, because they're already pretty optimal. > > > >In fact, by overriding the defaults there's a good chance > > > >to make things worse. :-) > > > > > > > >The default CFLAGS are "-O2 -pipe -fno-strict-aliasing". > > > >Anything above -O2 isn't supported, and using -O2 without > > > >-fno-strict-aliasing also isn't supported (and will create > > > >broken code for some programs). A common mistake is to > > > >specify CFLAGS="-O2 -pipe" and omit -fno-strict-aliasing. > > > >That'll shot you in the foot sooner or later. > > > > > > > >Best regards > > > > Oliver > > > > [[ ... ]] > > > > > > A couple of things. Will having gcc unroll loops have any > > negative consequences? (I can't imagine how:: but better > > informed than to have something crash inexplicability.) > > With 6.X safe at -O2 and with -funroll-loops, that should be > > a slight gain, right? (It also will make an upgrade from 5.5 > > to 6.[12] that much more rational.) > > > > [Dumb] questions:: first, what does the compiler do with > > "-fno-strict-aliasing"? And is there any guess, any SWAG even, > > on when FreeBSD will safe with -O3?? > > Lots of code is not strict-aliasing safe. Gcc itself can't > determine all the cases which a construct is not strict-aliasing > safe so even after getting rid of all the warnings gcc > produces you can't be sure your code is strict-aliasing > safe. Think of -fstrict-aliasing as optimisation without > a saftey net. If your code doesn't cast pointers you should > be safe otherwise you need to be really, really, really > careful when you turn this on. > Well, my own pointer code is pretty trustworthy. It's also pretty simple-minded and thoroughly tested, even tho it's just for my own use. Other's code, dunno. People who cut their teeth on pointers and may be just a wee bit cavalier: *Bzzz* Point well taken. -- Gary Kline kline@thought.org www.thought.org Public service Unix