Re: Compiler loop optimizations

"Robert H" <robert.hundt@gmail.com>
1 Jan 2007 11:50:55 -0500

          From comp.compilers

Related articles
Compiler loop optimizations linuxkaffee@gmx.net (Christian Sturz) (2006-12-29)
Re: Compiler loop optimizations emailamit@gmail.com (Amit Gupta) (2006-12-31)
Re: Compiler loop optimizations robert.hundt@gmail.com (Robert H) (2007-01-01)
Re: Compiler loop optimizations robert.hundt@gmail.com (Robert H) (2007-01-01)
Re: Compiler loop optimizations torbenm@app-0.diku.dk (2007-01-05)
Re: Compiler loop optimizations linuxkaffee@gmx.net (Christian Sturz) (2007-01-05)
Re: Compiler loop optimizations emailamit@gmail.com (Amit Gupta) (2007-01-07)
Compiler loop optimizations Heiko.Falk@udo.edu (Heiko Falk) (2007-01-10)
Re: Compiler loop optimizations hebisch@math.uni.wroc.pl (Waldek Hebisch) (2007-01-11)
[1 later articles]
| List of all articles for this month |

From: "Robert H" <robert.hundt@gmail.com>
Newsgroups: comp.compilers
Date: 1 Jan 2007 11:50:55 -0500
Organization: Compilers Central
References: 06-12-109
Keywords: optimize
Posted-Date: 01 Jan 2007 11:50:55 EST

Index Set Splitting combined with dead code elimination could take of
the first case. The question is whether it would kick in ;-) It
probably depends on the other arc probabilities.


However, since all loop bounds are constant, if the compiler has a
decent loop optimizer (not sure whether gcc has one), or a decent
assertion/value propagation system, it should be no problem.


I suggest to run simple experiments and see what your compiler does.


Cheers
-- Robert


On Dec 29, 7:58 pm, Christian Sturz <linuxkaf...@gmx.net> wrote:
> Hi,
>
> I was curious if there are any gcc compiler optimizations that can improve
> this code:
>
> void foo10( )
> {
> for ( int i = 0; i < 10; ++i )
> {
> [...]
> if( i == 15 ) { [BLOCK1] }
> }
>
> }void foo100( )
> {
> for ( int i = 0; i < 100; ++i )
> {
> [...]
> if( i == 15 ) { [BLOCK2] }
> }
>
> }int main( void )
> {
> foo10( );
> foo100( );
> return 0;


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.