autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."


From: Robert Dewar
Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
Date: Sat, 30 Dec 2006 20:00:48 -0500 (EST)

Andrew Pinski wrote:

It does buy you something for code like:

if (a - 10 < 20)

Well that particular example is far fetched in code that people
expect to run efficiently, but with a bit of effort you could
come up with a more realistic example.

Compilers are always full of such optimizations which are simple to do
and get put in without any sound basis for determining that they actually
help. 

Now if they don't change semantics, then unhelpful optimizations (by this
I mean optimizations which don't in practice help real applications), are
only slightly damaging (they damage maintainability and reliability by
creating additional unnecessary special cases).

But if they are NOT semantically neutral in terms of expected usage, then
the burden should be much higher.

In my view, this comparison optimization should not have been put in
without justification given that it clearly does affect the semantics
of real code. Indeed if you really see code like

  if (a - 10 < 20)

in place of 

  if (a < 30)

a very likely explanation is that you are deliberately doing something
strange with wrap around, and should leave it alone.

You say "I don't want to see this optimization removed", why not?
The answer should hopefully be something like

because test # 5 in benchmark suite xxx takes a 3% hit

or even better

awk processing expressions like bla bla takes an n% hit

However, I suspect the real answer is

"it's a neat optimization, I did it, and it can only help, so why not
leave it in"

And that's to me not good enough for optimziations that break existing
programs.

Note that if (a - 10 < 20)

in the presence of wrap around semantics means something like

   if (a < 30 && a > minint + 9) ...

and perhaps that was exactly what was meant!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]