Hi, > I'd like to know your experiences with the gcc loop optimizations. > > What loop optimizations (in your opinion) can be applied to a large > number of programs and yield a (significant) improvement of the > program run-time?
in general, I would say invariant motion, load/store motion, strength reduction and loop unrolling. Most of the other loop optimizations tend to apply only in special situations. Note however that the usefulness also heavily depends on the type of the compiled code; e.g., wide class of programs (simulations, optimization) spend most of the time doing simple calculations on large arrays, and other optimizations (loop interchange/reordering/..., prefetching) become important. > I've tested the gcc compiler optimization "loop unswitching" > (introduced in gcc 3.4) but going through a large number of different > benchmarks I could find very few cases where the optimization could be > applied. Do you share my experience? yes, the situations where loop unswitching can be applied are not very common. Zdenek