search for: pred_begin

Displaying 20 results from an estimated 54 matches for "pred_begin".

2005 Jan 13
2
[LLVMdev] the pred_begin and pred_end of BasicBlock
hi, I'm a bit confused by the pred_begin/end of BasicBlock in CFG.h. I cann't understand what is a **use** of a BasicBlock. Also, I have no idea of when CFG would be constructed in LLVM. Thanks. Zhou Feng
2005 Jan 13
0
[LLVMdev] the pred_begin and pred_end of BasicBlock
On Thu, 13 Jan 2005, Zhou Feng wrote: > hi, > I'm a bit confused by the pred_begin/end of BasicBlock in CFG.h. I cann't > understand what is a **use** of a BasicBlock. Also, I have no idea of when > CFG would be constructed in LLVM. The CFG is always implicit in LLVM. The two things that "use" BasicBlocks are branch/control flow instructions and PHI nodes...
2005 Jan 13
2
[LLVMdev] the pred_begin and pred_end of BasicBlock
...ctions explicit uses B. like this: A: code sequence does not contain br/other control flow instruction B: lable_of_b: code sequence Is A still a predecessor of B? Thanks. Chris Lattner wrote: > On Thu, 13 Jan 2005, Zhou Feng wrote: > >> hi, >> I'm a bit confused by the pred_begin/end of BasicBlock in CFG.h. I >> cann't understand what is a **use** of a BasicBlock. Also, I have no >> idea of when CFG would be constructed in LLVM. > > > The CFG is always implicit in LLVM. The two things that "use" > BasicBlocks are branch/control flow...
2011 Oct 14
0
[LLVMdev] BasicBlock succ iterator
...lock have a Terminator instruction and each blocks belongs to a function. I'm really confused. I guess the problem is caused by the removal of the Loop,The code is as follows: * //every block to header (except the ones in the loop), will now redirect to newblock for (pred_iterator PI = pred_begin(header); PI != pred_end(header); ++PI) { BasicBlock *pred = *PI; if (L->contains(pred)) { continue; } TerminatorInst *termInst = pred->getTerminator(); for (unsigned i = 0; i < termInst->getNumOperands(); i++) { BasicBlock...
2011 Jan 31
3
[LLVMdev] How to convert an iterator to an object pointer
...using following code and it given compile time errors. error: cannot convert 'llvm::const_pred_iterator' to 'const llvm::BasicBlock*' in initialization const BasicBlock *b = PH->getParent(); // process all pred block of the current block for (const_pred_iterator pr=pred_begin(b), esc=pred_end(b); pr!=esc; ++pr) { const BasicBlock *p = pr; // ************error line ****************
2011 Feb 01
0
[LLVMdev] Loop simplification
...e predecessor PHIs for (BasicBlock::iterator it = pred->begin(); it != pred->end(); ++it) { PHINode *phi = dyn_cast<PHINode>(it); UT_ASSERT(phi); // Adjust the PHI to have the correct incoming block set for (pred_iterator pi = pred_begin(succ); pi != pred_end(succ); ++pi) { // We're a different predecessor than the predecessor block if (*pi != pred) { phi->addIncoming(phi, *pi); } } } // Update successor PHIs...
2011 Feb 01
3
[LLVMdev] Loop simplification
On Feb 1, 2011, at 1:34 PM, Andrew Trick wrote: > On Feb 1, 2011, at 1:08 PM, Andrew Clinton wrote: > >> I have a (non-entry) basic block that contains only PHI nodes and an >> unconditional branch (that does not branch to itself). Is it always >> possible to merge this block with it's successor and produce a >> semantically equivalent program? I'm
2007 Jul 27
2
[LLVMdev] Couple of changes (2005 and other toolchain related)
...] This has to do with the fact that the STL debug validator checks to make sure that if !(lhs < rhs) then (rhs < lhs || rhs == lhs), so the '<' operator needs to be non-ambiguous. * BranchFolding.cpp, line 927, replace with: std::size_t dist = std::distance(PI, MBB->pred_begin()); ReplaceUsesOfBlockWith(*PI, MBB, CurTBB, TII); PI = MBB->pred_begin(); std::advance(PI, dist); I'm not sure if that is the correct fix, but what is currently there is definitely not correct. ReplaceUsesOfBlockWith can invalidate iterators (because internally it adds or removes i...
2007 Dec 20
4
[LLVMdev] First time!
Hi! I want to know How to count the number of predecessors for each basic block? Thank You ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs
2008 Jan 22
3
[LLVMdev] Walking all the predecessors for a basic block
Hi all, Is there a way to walk through ALL the predecessors of a basic block in a CFG. I tried to iterate over the preds using this method for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++I) { BasicBlock *PredBB = *PI; } but this only gives the immediate predecessors for a basic block. For example, in this sample control flow graph. entry -> bb1 -> bb2 -> bb4 -> return | | bb3 <-| wa...
2010 May 04
2
[LLVMdev] Question about GVN
Hello, I was investigating GVN.cpp file and I found suspicious part: 1587 bool NeedToSplitEdges = false; 1588 for (pred_iterator PI = pred_begin(LoadBB), E = pred_end(LoadBB); 1589 PI != E; ++PI) { 1590 BasicBlock *Pred = *PI; 1591 if (IsValueFullyAvailableInBlock(Pred, FullyAvailableBlocks)) { 1592 continue; 1593 } 1594 PredLoads[Pred] = 0; 1595 1596 if (Pred->getTerminator()->getNumSuccessors() != 1...
2010 Jun 25
3
[LLVMdev] LLVM:help
How can I get list of its predecessor basic blocks from a basic block? --Rajwinder Singh -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100625/21c52063/attachment.html>
2010 Jun 25
0
[LLVMdev] LLVM:help
On 25/06/10 06:05, RAJWINDER SINGH wrote: > How can I get list of its predecessor basic blocks from a basic block? If BB is a BasicBlock*, you can get begin and end iterators using pred_begin(BB) and pred_end(BB). Ciao, Duncan.
2011 Jan 31
0
[LLVMdev] How to convert an iterator to an object pointer
...ompile time > errors. > > error: cannot convert 'llvm::const_pred_iterator' to 'const > llvm::BasicBlock*' in initialization > > const BasicBlock *b = PH->getParent(); > // process all pred block of the current block > for (const_pred_iterator pr=pred_begin(b), esc=pred_end(b); pr!=esc; > ++pr) > { const BasicBlock *p = pr; // ************error line > **************** > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs....
2018 Aug 15
2
Queries Regarding Usage of PGOInstrumentation Passes instead of Deprecated ProfileInfo
...Info. It essentially computes the number of iterations performed by a loop from the profiling information available. The code snippet in my pass looks something like this. BasicBlock *header = loop->getHeader(); ProfileInfo &pi = getAnalysis< ProfileInfo >(); for(pred_iterator i=pred_begin(header), e=pred_end(header); i!=e; ++i) { BasicBlock *pred = *i; const double edgeCount = *pi.getEdgeWeight*( ProfileInfo::Edge(pred,header) ); */* Some code */* } Now, since ProfileInfo has been deprecated and we have PGOInstrumentation passes along with BranchProbability and Blo...
2019 Oct 30
2
How to make ScalarEvolution recompute SCEV values?
...I, const Twine &NameSuffix, ValueToValueMapTy &VMap) { // original preheader of the loop const auto PreHeader = L->getLoopPreheader(); // keep track of the original predecessors std::set<BasicBlock *> AllPredecessors; for (auto PredIt = pred_begin(PreHeader), E = pred_end(PreHeader); PredIt != E; PredIt++) AllPredecessors.insert(*PredIt); BasicBlock *ExitBlock = L->getExitBlock(); auto DT = DominatorTree(*F); SmallVector<BasicBlock *, 8> Blocks; const auto ClonedLoop = cloneLoopWithPre...
2008 May 14
1
[LLVMdev] Useless check in TailDuplication
...Dest can have zero predecessors. By definition, it has at least one: The block containing BI. Is there a point I am missing here, or is this really a useless check? In particular, I'm talking about the following piece of code from lib/Transforms/Scalar/TailDuplication.cpp: pred_iterator PI = pred_begin(Dest), PE = pred_end(Dest); if (PI == PE && Dest != Dest->getParent()->begin()) return false; // It's just a dead block, ignore it... The attached patch removes this check. I can't find any problems with it, it causes no tests to fail. Gr. Matthijs -------------- nex...
2004 Nov 10
1
[LLVMdev] Help : CFG in LLVM ( Implementation)
...representation. Every BasicBlock ends with a terminator instruction, which is one of these: http://llvm.cs.uiuc.edu/docs/LangRef.html#terminators Each terminator has explicit target BasicBlocks (if any), which means you can navigate the CFG directly using the terminators or you can use the API pred_begin/end() and succ_begin/end() found in llvm/include/llvm/Support/CFG.h If you are not sure how to use them, search the code base for one of them to find example usage. > Is there any existing tool that LLVM provides that makes CFG out of > bytecode ? Above I described how to navigate the...
2011 Oct 13
6
[LLVMdev] BasicBlock succ iterator
Hi, All I want to implement DSWP Which is used for parallelization of loops. For this purpose, the loop was replaced with a new basic block in main function. And new functions were created and basic blocks of Loop assigned to them.I have checked blocks and branches for Succ and Pred relation and I have not found any problems. However I get the following error: * **opt:
2017 May 01
3
RFC: Stop using redundant PHI node entries for multi-edge predecessors
Today, the IR requires that if you have multiple edges from A to B (typically with a switch) any phi nodes in B must have an equal number of entries for A, but that all of them must have the same value. This seems rather annoying.... 1) It creates multiple uses of values in A for no apparently good reason 2) It makes updating PHI nodes using sets of predecessors incredibly hard 3) There is no