search for: getloopfor

Displaying 20 results from an estimated 31 matches for "getloopfor".

2011 Feb 28
2
[LLVMdev] LoopInfo of a basic block
Hi all, How Can I get the Loops around an Instruction? I know I can get the basic block of an instruction using inst.getParent() which returns a BasicBlock*. Now I want to use the getLoopFor(BasicBlock) method of the class LoopInfo. But I dont know how to get the LoopInfo. BasicBlock* bb = inst.getParent(); (... what should I add here?) Loop* innerloop = LI -> getLoopFor(bb): Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists...
2012 Apr 26
2
[LLVMdev] Detect if a basicblock is part of a loop
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.co...
2011 Feb 28
2
[LLVMdev] LoopInfo of a basic block
...On Feb 28, 2011, at 2:35 PM, Naznin Fauzia wrote: > >> Hi all, >> >> How Can I get the Loops around an Instruction? >> >> I know I can get the basic block of an instruction using >> inst.getParent() which returns a BasicBlock*. Now I want to use the >> getLoopFor(BasicBlock) method of the class LoopInfo. >> But I dont know how to get the LoopInfo. >> >> BasicBlock* bb = inst.getParent(); >> >> (... what should I add here?) >> >> Loop* innerloop = LI -> getLoopFor(bb): >> > > Two steps: > 1) In your...
2011 Feb 28
0
[LLVMdev] LoopInfo of a basic block
On Feb 28, 2011, at 2:35 PM, Naznin Fauzia wrote: > Hi all, > > How Can I get the Loops around an Instruction? > > I know I can get the basic block of an instruction using inst.getParent() which returns a BasicBlock*. Now I want to use the getLoopFor(BasicBlock) method of the class LoopInfo. > But I dont know how to get the LoopInfo. > > BasicBlock* bb = inst.getParent(); > > (... what should I add here?) > > Loop* innerloop = LI -> getLoopFor(bb): > Two steps: 1) In your pass's getAnalysisUsage(), request Lo...
2011 Feb 28
0
[LLVMdev] LoopInfo of a basic block
...evang Patel wrote: > > > On Feb 28, 2011, at 2:35 PM, Naznin Fauzia wrote: > > Hi all, > > How Can I get the Loops around an Instruction? > > I know I can get the basic block of an instruction using inst.getParent() > which returns a BasicBlock*. Now I want to use the getLoopFor(BasicBlock) > method of the class LoopInfo. > But I dont know how to get the LoopInfo. > > BasicBlock* bb = inst.getParent(); > > (... what should I add here?) > > Loop* innerloop = LI -> getLoopFor(bb): > > > Two steps: > 1) In your pass's getAnalysisUsa...
2012 Apr 26
0
[LLVMdev] Detect if a basicblock is part of a loop
...gt; > 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://co...
2011 Feb 28
1
[LLVMdev] LoopInfo of a basic block
...;> On Feb 28, 2011, at 2:35 PM, Naznin Fauzia wrote: >> >> Hi all, >> >> How Can I get the Loops around an Instruction? >> >> I know I can get the basic block of an instruction using inst.getParent() >> which returns a BasicBlock*. Now I want to use the getLoopFor(BasicBlock) >> method of the class LoopInfo. >> But I dont know how to get the LoopInfo. >> >> BasicBlock* bb = inst.getParent(); >> >> (... what should I add here?) >> >> Loop* innerloop = LI -> getLoopFor(bb): >> >> >> Two step...
2005 Jun 29
1
[LLVMdev] null pointer check missing in LoopInfo
In LLVM 1.5, the function isLoopHeader fails to check for a null pointer after calling getLoopFor. Dunno if this is fixed in CVS, but attaching a patch anyway ... Sameer. -- Research Scholar, KReSIT, IIT Bombay http://www.it.iitb.ac.in/~sameerds/ -------------- next part -------------- --- LoopInfo.h 2005-06-29 17:42:43.000000000 +0530 +++ llvm/include/llvm/Analysis/LoopInfo.h 2005-06-29 17:5...
2012 Mar 09
2
[LLVMdev] How to keep FunctionPass analysis result alive in Module Pass?
...alive. Here is an example showing the problem I encountered, assuming I already addRequired<llvm::LoopInfo>() in getAnalysisUsage: void foo(llvm::Function *F1, llvm::Function *F2) { llvm::LoopInfo *LI1, LI2; LI1 = &getAnalysis<llvm::LoopInfo>(*F1); llvm::Loop* L1 = LI1->getLoopFor(F1->begin()); LI2 = &getAnalysis<llvm::LoopInfo>(*F2); llvm::Loop* L2 = LI2->getLoopFor(F2->begin()); L1->dump(); // crash L2->dump(); } I checked why this program crashes. It is because the getAnalysis returns same LoopInfo instance. Each time it clears previou...
2012 Apr 26
2
[LLVMdev] Detect if a basicblock is part of a loop
...tect 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 t...
2012 Mar 09
0
[LLVMdev] How to keep FunctionPass analysis result alive in Module Pass?
...le showing the problem I encountered, assuming I already addRequired<llvm::LoopInfo>() in getAnalysisUsage: > > void foo(llvm::Function *F1, llvm::Function *F2) { > llvm::LoopInfo *LI1, LI2; > LI1 =&getAnalysis<llvm::LoopInfo>(*F1); > llvm::Loop* L1 = LI1->getLoopFor(F1->begin()); > LI2 =&getAnalysis<llvm::LoopInfo>(*F2); > llvm::Loop* L2 = LI2->getLoopFor(F2->begin()); > L1->dump(); // crash > L2->dump(); > } > > I checked why this program crashes. It is because the getAnalysis returns same LoopInfo inst...
2012 Mar 09
3
[LLVMdev] How to keep FunctionPass analysis result alive in Module Pass?
...m I encountered, assuming I already addRequired<llvm::LoopInfo>() in getAnalysisUsage: >> >> void foo(llvm::Function *F1, llvm::Function *F2) { >> llvm::LoopInfo *LI1, LI2; >> LI1 = &getAnalysis<llvm::LoopInfo>(*F1); >> llvm::Loop* L1 = LI1->getLoopFor(F1->begin()); >> LI2 = &getAnalysis<llvm::LoopInfo>(*F2); >> llvm::Loop* L2 = LI2->getLoopFor(F2->begin()); >> L1->dump(); // crash >> L2->dump(); >> } >> >> I checked why this program crashes. It is because the getAnaly...
2012 Apr 26
0
[LLVMdev] Detect if a basicblock is part of a loop
...dini 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.com...
2018 Nov 27
2
ScalarEvolution class returns no valid loop exit count
...lowing initialization: ...... void analysis(Function* func) DominatorTree DT = DominatorTree(); DT.recalculate(*func); DT.updateDFSNumbers(); LoopInfoBase<BasicBlock, Loop> LIB; LIB.releaseMemory(); LIB.analyze(DT); for(auto&bb :*func){ Loop * L = LIB.getLoopFor(&bb); if(L != nullptr){ AssumptionCache AC = AssumptionCache(*bb.getParent()); Triple MT(llvm::sys::getDefaultTargetTriple()); TargetLibraryInfoImpl TLII(MT); TargetLibraryInfoWrapperPass TLI = TargetLibraryInfoWrapperPass(TLII);...
2007 Dec 11
2
[LLVMdev] LoopInfo Question
Hi, 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? Thanks! -bw
2010 Aug 14
0
[LLVMdev] Questions about trip count
...unctionPass(&ID) {} void getLoopInfo(const Function& F) const { const LoopInfo *LI = &getAnalysis<LoopInfo> (); ScalarEvolution *SE = &getAnalysis<ScalarEvolution> (); Function::const_iterator BB = F.begin(), E = F.end(); for (; BB != E; ++BB) { const Loop* L = LI->getLoopFor(&*BB); if (L != NULL) { errs() << "Trip count: " << *SE->getBackedgeTakenCount(L); L->dump(); } } } virtual bool runOnFunction(Function &F) { HelloCounter++; errs() << "Hello: "; errs().write_escaped(F.getName()) << '\n'; getLoopIn...
2012 Mar 09
0
[LLVMdev] How to keep FunctionPass analysis result alive in Module Pass?
...suming I already addRequired<llvm::LoopInfo>() in getAnalysisUsage: >>> >>> void foo(llvm::Function *F1, llvm::Function *F2) { >>> llvm::LoopInfo *LI1, LI2; >>> LI1 =&getAnalysis<llvm::LoopInfo>(*F1); >>> llvm::Loop* L1 = LI1->getLoopFor(F1->begin()); >>> LI2 =&getAnalysis<llvm::LoopInfo>(*F2); >>> llvm::Loop* L2 = LI2->getLoopFor(F2->begin()); >>> L1->dump(); // crash >>> L2->dump(); >>> } >>> >>> I checked why this program crashes....
2010 Aug 12
2
[LLVMdev] Questions about trip count
On 08/12/2010 09:41 PM, Douglas do Couto Teixeira wrote: > Dear guys, > > I am having problems to obtain good information from the LoopInfo. > I am always getting a trip count of 0, even though I am clearly passing > a loop with a constant bound. I am using this pass below: Hi, I would propose to first check if the trip count is calculated correctly. I would do this with opt
2009 Sep 29
1
[LLVMdev] Irreducible Control-Flow & Loops
...I agree that it is not very convenient to make it more complicated for rather uncommon cases. I think I will implement an independent "IrreducibleLoopInfo" pass that discovers loops in the presence of multiple entries and offers an interface similar to LoopInfo (iterators, getHeaders(), getLoopFor(), ...). A question that is related: do the available SCC iterators provide nested SCCs as well or do I have to compute them manually? Regards, Ralf
2005 Jul 28
2
[LLVMdev] help with pointer-to-array conversion
...ruction::GetElementPtr) // We want this to become explicit... > { > std::cerr << "Block Before: " << *GEPI->getParent(); > Instruction *mul = BinaryOperator::createMul(saved_trip_count, > LI->getLoopFor( phi->getIncomingBlock(1) ) > ->getCanonicalInductionVariable(), "mul.", GEPI); > Instruction *add = BinaryOperator::createAdd(mul, NewAdd, "add.", GEPI); > GEPI->setOperand( 0, phi-&gt...