[LLVMdev] Detect if a basicblock is part of a loop

Hal Finkel hfinkel at anl.gov
Thu Apr 26 07:57:53 PDT 2012


Rinaldini,

What exactly did you run? Specifically, you may be missing some
analysis passes that are necessary for LoopInfo to have the loop
information you desire.

 -Hal

On Thu, 26 Apr 2012 14:02:04 +0000
Rinaldini Julien <julien.rinaldini at heig-vd.ch> wrote:

> Hi,
> 
> I'm trying to detect if a basicblock is part of a loop or not.
> 
> I tried the llvm::LoopInfo like that
> (http://llvm.org/docs/doxygen/html/classllvm_1_1LoopInfo.html#a4abca289c73cd09487e05d11d9f7d877):
> 
> LoopInfo *loop = new LoopInfo();
> bool isLoop = loop->getLoopFor(myBB); // getLoopFor - Return the
> inner most loop that BB lives in. If a basic block is in no loop (for
> example the entry node), null is returned. See doxygen 
> 
> But getLoopFor() always return me NULL even if my basicblock is
> inside a for loop... I tried this:
> http://comments.gmane.org/gmane.comp.compilers.llvm.devel/38490 but
> it didn't work too :(
> 
> Any advice?
> Thx 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list