> > 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 be > > evaluated in each loop iteration. Can this code transformation be > > automatically performed by a compiler? > Yes > >If so, which techniques/analyses and optimizations must be applied? > There are a number of ways to do it, but the easiest is probably value > range propagation. > > >Would gcc simplify this loop? > > yes
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? Up to now, I used the "-S" flag to produced the optimized code in assembly. But at that level it's hard to recognize what optmizations gcc performed. Regards, Christian