Loop Deletion
From LLVM
The LoopDeletion pass is responsible for eliminating loops with non-infinite computable trip counts that have no side effects or volatile instructions, and do not contribute to the computation of the function's return value.
[edit] How it works (for newbies)
The conditions that a loop has to met to be deleted are:
- Not having innerloops, because if they are dead, there would have been removed in an earlier pass.
- Having a preheader.
- Having a single exit basic block. If not, it would be necessary to implement the branching logic in a loop invariant manner.
- Having a non-infinite trip count, so it's not avoided the hang-up.
- To be completed

