search for: block_begin

Displaying 20 results from an estimated 28 matches for "block_begin".

2014 May 02
2
[LLVMdev] An unexpected behavior in RegionInfo's block_iterator
...ever contain a single basic block or even a sequence of basic blocks. So maybe the above degenerated case is considered "will never happen"? ... ... BasicBlock *BB = Func.getARandomBasicBlock; Region *R = new Region(BB, BB, RI, DT); for (Region::block_iterator i = R->block_begin(), e = R->block_end(); i != e; ++i) { errs() << (*i)->getName() << "\n"; } ... ... Best Regards, Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachme...
2011 Oct 14
0
[LLVMdev] BasicBlock succ iterator
...BasicBlock *bb = dyn_cast<BasicBlock> (termInst->getOperand(i)); if (bb == header) { termInst->setOperand(i,newBlock); } } }* * cout << "begin to delete loop" << endl; for (Loop::block_iterator bi = L->block_begin(), bi2; bi != L->block_end(); bi = bi2) { bi2 = bi; bi2++; BasicBlock * BB = *bi; for (BasicBlock::iterator ii = BB->begin(), ii2; ii != BB->end(); ii= ii2) { ii2 = ii; ii2++; Instruction *inst = ii;...
2012 Jul 05
3
[LLVMdev] "symbol lookup error" while running a Simple Loop Pass
...e { struct LoopInst : public LoopPass { static char ID; // Pass identification, replacement for typeid LoopInst() : LoopPass(ID) {} virtual bool runOnLoop(Loop *L, LPPassManager &LPM) { LoopInfo *LI = &getAnalysis<LoopInfo>(); for (Loop::block_iterator b = L->block_begin(), be = L->block_end();b != be; ++b) { for (BasicBlock::iterator i = (*b)->begin(), ie = (*b)->end(); i != ie; ++i) { ++LoopInstNum; errs() << "Hello: "; } } return false; } // We don't modify the program, so we preserve all analyses virt...
2011 Oct 06
1
[LLVMdev] replacing a global variable by a constant
I would delete the Loop. I used the following code. cout << "begin to delete loop" << endl; for (Loop::block_iterator bi = L->block_begin(), bi2; bi != L->block_end(); bi = bi2) { bi2 = bi; bi2++; BasicBlock * BB = *bi; for (BasicBlock::iterator ii = BB->begin(), ii2; ii != BB->end(); ii= ii2) { ii2 = ii; ii2++; Instruction *inst = ii; inst->e...
2013 May 21
1
[LLVMdev] How to find the first block of each loop
...o code between loops: for( i = 0 ; i < N; i++){ arrayA[i] = i + 1; } for( j = 0 ; j < N; j++){ arrayA[j] = j + 1; } for( k = 0 ; k < N; k++){ arrayC[k] = k + 1; } In this case, these loops have the same header block, so the previous method failed. And it seems the method of block_begin() returns the same value as getHeader(). Are there some other methods to implement this ? Thanks! Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130521/20db76c1/attachment.html>
2012 Dec 01
0
[LLVMdev] [RFC] "noclone" function attribute
...lar in it: /// isSafeToClone - Return true if the loop body is safe to clone in practice. /// Routines that reform the loop CFG and split edges often fail on indirectbr. bool Loop::isSafeToClone() const { // Return false if any loop blocks contain indirectbrs. for (Loop::block_iterator I = block_begin(), E = block_end(); I != E; ++I) { if (isa<IndirectBrInst>((*I)->getTerminator())) return false; } return true; } Maybe a similar interface could be added to Instruction, and an instruction would declare itself unsafe to clone if it was a call to a function with the...
2012 Jul 05
0
[LLVMdev] "symbol lookup error" while running a Simple Loop Pass
...e { struct LoopInst : public LoopPass { static char ID; // Pass identification, replacement for typeid LoopInst() : LoopPass(ID) {} virtual bool runOnLoop(Loop *L, LPPassManager &LPM) { LoopInfo *LI = &getAnalysis<LoopInfo>(); for (Loop::block_iterator b = L->block_begin(), be = L->block_end();b != be; ++b) { for (BasicBlock::iterator i = (*b)->begin(), ie = (*b)->end(); i != ie; ++i) { ++LoopInstNum; errs() << "Hello: "; } } return false; } // We don't modify the program, so we preserve all analyses v...
2012 Jul 05
1
[LLVMdev] "symbol lookup error" while running a Simple Loop Pass
...c LoopPass { > static char ID; // Pass identification, replacement for typeid > LoopInst() : LoopPass(ID) {} > > virtual bool runOnLoop(Loop *L, LPPassManager &LPM) { > LoopInfo *LI = &getAnalysis<LoopInfo>(); > for (Loop::block_iterator b = L->block_begin(), be = L->block_end();b != be; > ++b) > { > for (BasicBlock::iterator i = (*b)->begin(), ie = (*b)->end(); i != ie; ++i) > { > ++LoopInstNum; > errs() << "Hello: "; > } > } > > return false; > } > > // We don...
2011 Oct 05
2
[LLVMdev] replacing a global variable by a constant
hi i want replacing a global variable by a constant value for erase instruction. i had seen the code that as follows for (llvm::GlobalVariable::use_iterator U = gv->use_begin(); U != gv->use_end();--U ) { llvm::Instruction *I = llvm::cast<llvm::Instruction>(U); I->replaceAllUsesWith(constPtr); I->eraseFromParent(); } but i dont know how can declare constptr.
2011 Oct 05
0
[LLVMdev] replacing a global variable by a constant
Hi nada, > i want replacing a global variable by a constant value for erase instruction. I'm not sure what you mean exactly. A GlobalVariable has pointer type. Do you want to replace that pointer by a constant pointer? Or is it rather that you want to say that the contents of the memory pointed to by the GlobalVariable is constant, and have all places that load that GlobalVariable
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 Sep 25
2
Potential infinite loop in MemorySSAUpdater
...if (!Phi) Phi = MSSA->createMemoryPhi(BB); // These will have been filled in by the recursive read we did above. if (PHIExistsButNeedsUpdate) { std::copy(PhiOps.begin(), PhiOps.end(), Phi->op_begin()); std::copy(pred_begin(BB), pred_end(BB), Phi->block_begin()); } else { unsigned i = 0; for (auto *Pred : predecessors(BB)) Phi->addIncoming(PhiOps[i++], Pred); } Result = Phi; } if (MemoryPhi *MP = dyn_cast<MemoryPhi>(Result)) InsertedPHIs.push_back(MP); // Set ourselves up for the ne...
2012 Dec 01
6
[LLVMdev] [RFC] "noclone" function attribute
Hi, OpenCL has a "barrier" function with very specific semantics, and there is currently no analogue to model this in LLVM. This has been touched on by the SPIR folks but I don't believe they put forward a proposal. The barrier function is a special function that ensures that all workitems executing a kernel have executed up to that point before execution on any workitem can
2012 Dec 01
2
[LLVMdev] [RFC] "noclone" function attribute
...milar in it: /// isSafeToClone - Return true if the loop body is safe to clone in practice. /// Routines that reform the loop CFG and split edges often fail on indirectbr. bool Loop::isSafeToClone() const { // Return false if any loop blocks contain indirectbrs. for (Loop::block_iterator I = block_begin(), E = block_end(); I != E; ++I) { if (isa<IndirectBrInst>((*I)->getTerminator())) return false; } return true; } Maybe a similar interface could be added to Instruction, and an instruction would declare itself unsafe to clone if it was a call to a function with the att...
2014 May 02
2
[LLVMdev] An unexpected behavior in RegionInfo's block_iterator
...maybe the above degenerated case is considered "will never >> happen"? >> >> ... ... >> >> BasicBlock *BB = Func.getARandomBasicBlock; >> >> Region *R = new Region(BB, BB, RI, DT); >> for (Region::block_iterator i = R->block_begin(), >> e = R->block_end(); i != e; ++i) { >> errs() << (*i)->getName() << "\n"; >> } >> > > > Hi Paul, > > the exit basic block is the block after the region. > > BB0 < Entering Block > | &...
2013 May 15
2
[LLVMdev] [polly] Polly Loop info and LoopSimplify functionality
...locks (other than the header) in this loop have // predecessors that are not in the loop. This is not valid for natural // loops, but can occur if the blocks are unreachable. Since they are // unreachable we can just shamelessly delete those CFG edges! for (Loop::block_iterator BB = L->block_begin(), E = L->block_end(); BB != E; ++BB) { if (*BB == L->getHeader()) continue; SmallPtrSet<BasicBlock*, 4> BadPreds; for (pred_iterator PI = pred_begin(*BB), PE = pred_end(*BB); PI != PE; ++PI) { BasicBlock *P = *PI; if (!L->contains(P))...
2017 Sep 25
0
Potential infinite loop in MemorySSAUpdater
...oryPhi(BB); > > > > // These will have been filled in by the recursive read we did above. > > if (PHIExistsButNeedsUpdate) { > > std::copy(PhiOps.begin(), PhiOps.end(), Phi->op_begin()); > > std::copy(pred_begin(BB), pred_end(BB), Phi->block_begin()); > > } else { > > unsigned i = 0; > > for (auto *Pred : predecessors(BB)) > > Phi->addIncoming(PhiOps[i++], Pred); > > } > > > > Result = Phi; > > } > > if (MemoryPhi *MP = dyn_cast<Me...
2009 Jul 02
0
[LLVMdev] Profiling in LLVM Patch
...d::pair<BlockT*,BlockT*> Edge; >>> +  void getExitEdges(SmallVectorImpl<Edge> &ExitEdges) const { >>> +    // Sort the blocks vector so that we can use binary search to do quick >>> +    // lookups. >>> +    SmallVector<BlockT*, 128> LoopBBs(block_begin(), block_end()); >>> +    std::sort(LoopBBs.begin(), LoopBBs.end()); >> >> Would it be better to use a DenseSet for this lookup? > Well, its the same that is used in getExitBlocks() where I got the implementation from. I really don't know but I think the current implemen...
2013 Jan 31
0
[LLVMdev] [PATCH] parallel loop metadata
Dear all, Here's an updated version of the parallel loop metadata patch. It includes documentation for the new metadata types with a semantics description. -- Pekka -------------- next part -------------- A non-text attachment was scrubbed... Name: parallel-loop-metadata.patch Type: text/x-patch Size: 12972 bytes Desc: not available URL:
2012 Mar 28
0
[LLVMdev] GSoC 2012 Proposal: Python bindings for LLVM
...e correct exception handling. llvm-py should support them. d. Passes. Some passes are removed, for instance, *LowerSetJmp* pass. So the API that is corresponding to them such as LLVMAddLowerSetJmpPass, should also be removed in llvm-py. e. PHINode. Two new functions are added in PHINode class: *block_begin* and *block_end*. The list of incoming BasicBlocks can be accessed with these functions. At the same time, reserveOperandSpace function is removed so when creating a PHINode, an extra argument is needed to specify how many operands to reserve space. When making llvm-py work with LLVM 3.0, we should...