Loop dependences and optimizations
Dependence within one instance of the loop
- Not much opportunity to optimize
Loop-carried dependences
- Dependence between different iterations of the loop
- Potential for loop unrolling and software pipelining
- The further the dependence distance between iterations, the more potential for loop unrolling
- Detecting these dependences is not easy (so-called memory dependence problem: recognizing that two addresses are the same)
- A compiler has to be conservative and in doubt assume the worse, i.e. assume a dependence.