Junjie Gu
2010-Mar-16 23:37 UTC
[LLVMdev] LoopSimplify : why to separate a loop with multiple backedges into a nested loop ?
Hello, 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 ? Junjie
Dan Gohman
2010-Mar-17 02:09 UTC
[LLVMdev] LoopSimplify : why to separate a loop with multiple backedges into a nested loop ?
On Mar 16, 2010, at 4:37 PM, Junjie Gu wrote:> Hello, > > 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 example. LLVM doesn't have all that many loop optimizations currently; if it had more, there would be more cases where this canonicalization could help. Dan