[LLVMdev] LoopInfo Question
Chris Lattner
sabre at nondot.org
Mon Dec 10 17:30:22 PST 2007
On Mon, 10 Dec 2007, Bill Wendling wrote:
> If I do a loop over the basic blocks in a LoopInfo object, is it going
> to loop over the basic blocks of the loop AND the subloops of the loop
> or just the BBs of the loop itself?
A loop's block list include blocks that are part of subloops. The
canonical way to determine if a block is in "this loop and not a child"
is:
if (LI->getLoopFor(BB) == ThisLoop)
If BB is part of a child loop, getLoopFor will return it so the compare
will fail.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list