[LLVMdev] LoopSimplify : why to separate a loop with multiple backedges into a nested loop ?
gohman at apple.com
Tue Mar 16 21:09:54 CDT 2010
On Mar 16, 2010, at 4:37 PM, Junjie Gu wrote:
> LoopSimplify try to separate a loop with multiple backedges into a
> nested loop (an outer loop and an inner loop).
> Naturally, this kind of a loop corresponds to a single loop in source
> code. I can see this could be useful for cases described in the
> comments in lib/Transforms/Utils/LoopSimplify.cpp, which looks like a
> corner case. For most cases,
> how does this help ?
It helps later passes optimize the inner loop. For
example, an expression may be loop-invariant in the inner loop
but not in the outer loop. Separating them into two loops
allows LICM to hoist the value out of the inner loop, for
LLVM doesn't have all that many loop optimizations currently; if it
had more, there would be more cases where this canonicalization
More information about the LLVMdev