Re: Compiler loop optimizations

2006-12-29 Thread Ian Lance Taylor
Christian Sturn <[EMAIL PROTECTED]> writes: > On Fri, 29 Dec 2006 15:03:51 -0500 > Robert Dewar <[EMAIL PROTECTED]> wrote: > > > > There is no support for dumping actual valid source code, though, > > > and it is unlikely that there ever will be. > > > > And indeed it is not in general possible,

Re: Compiler loop optimizations

2006-12-29 Thread Christian Sturn
On Fri, 29 Dec 2006 15:03:51 -0500 Robert Dewar <[EMAIL PROTECTED]> wrote: > > There is no support for dumping actual valid source code, though, > > and it is unlikely that there ever will be. > > And indeed it is not in general possible, there are many optimizations > that cannot be expressed in

Re: Compiler loop optimizations

2006-12-29 Thread Robert Dewar
Ian Lance Taylor wrote: Christian Sturn <[EMAIL PROTECTED]> writes: Thank you for your answer. Is there any chance to have gcc dump out an optimized code in the form the source level language, e.g. can I run gcc with some optimizations and see how the compiler modified my C source code? You

Re: Compiler loop optimizations

2006-12-29 Thread Ian Lance Taylor
Christian Sturn <[EMAIL PROTECTED]> writes: > Thank you for your answer. Is there any chance to have gcc dump out > an optimized code in the form the source level language, e.g. can I run > gcc with some optimizations and see how the compiler modified my C > source code? You can get an approxima

Re: Compiler loop optimizations

2006-12-29 Thread Christian Sturn
> > 1) For the function foo10: > > The if-block following "if( i == 15 )" will be never executed since > > 'i' will never become 15 here. So, this entire block could be > > removed without changing the semantics. This would improve the > > program execution since the if-condition does not need to b

Re: Compiler loop optimizations

2006-12-28 Thread Daniel Berlin
On 12/28/06, Christian Sturz <[EMAIL PROTECTED]> 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