[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GCC optimizes integer overflow: bug or feature?
From: |
Andrew Pinski |
Subject: |
Re: GCC optimizes integer overflow: bug or feature? |
Date: |
Tue, 19 Dec 2006 00:59:07 -0800 |
On Tue, 2006-12-19 at 03:42 -0500, Robert Dewar wrote:
>
> When I worked on SPITBOL, people all the time were suggesting
> optimizations in letters to the SPITBOL newsletter. I imposed
> a rule saying that no one could propose an optimization unless
> they could show ONE example program where the optimization could
> plausibly save 5% execution time. I never got another suggestion.
http://gcc.gnu.org/bugzilla//show_bug.cgi?id=18527
A simple loop like:
int foo ()
{
int a[N];
int i;
int n;
for (i = 0; i <= n; i++)
ca[i] = 2;
}
we cannot find how many iterations it runs without knowing that signed
types overflow.
And yes people write code like that, it shows up in GCC itself IIRC (as
the original testcase comes from GCC in SPEC).
I don't have the number of times this shows up or how much it helps but
it does help out on being able to vectorize this loop.
Another example (this time for "for (i=i0; i<=i1+1; ++i)" )
http://gcc.gnu.org/bugzilla//show_bug.cgi?id=26900
via:
http://gcc.gnu.org/bugzilla//show_bug.cgi?id=26899
which can only be done when signed overflow is undefined.
All of these do show up in real code, and since loops are now more
important to optimize than anything else, well knowing the number of
iterations is very important.
Thanks,
Andrew Pinski
- Re: GCC optimizes integer overflow: bug or feature?, (continued)
- Re: GCC optimizes integer overflow: bug or feature?, Ian Lance Taylor, 2006/12/20
- Re: GCC optimizes integer overflow: bug or feature?, Joe Buck, 2006/12/20
- Re: GCC optimizes integer overflow: bug or feature? (was: avoid integer overflow in mktime.m4), Andrew Pinski, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Brooks Moses, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Andrew Haley, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?,
Andrew Pinski <=
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Florian Weimer, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Paolo Bonzini, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Florian Weimer, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Joseph S. Myers, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Paolo Bonzini, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/19