search for: gettermin

Displaying 20 results from an estimated 128 matches for "gettermin".

Did you mean: determin
2012 Dec 19
3
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
Hello everyone, I have a segmentation fault while running an LLVM pass. I need to use BBterminators array outside the iterating "for" loop for basic blocks. It seems that LLVM does not protect the addresses ( note: TerminatorInst *BasicBlock::getTerminator() ) when iterating through the loop, so I need to keep in BBterminators "Instruction" type elements, not "Instruction* ". How can I copy entire Instructions into BBterminators? for (Function::iterator II = F.begin(), EE = F.end(); II != EE; ++II, ++ii) { ....... /...
2012 Dec 20
3
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
Hello John, I was following your procedures and I isolated the problem. The problem are represented by the basic blocks with only one element. for (Function::iterator II = F.begin(), EE = F.end(); II != EE; ++II, ++ii) { BasicBlock* BB=II; if (BB->getTerminator()) { Instruction* current = BB->getTerminator(); Instruction* previous; errs()<<"AAA\n"; if(*current->getPrevNode()*) { errs()<<"BBB\n"; previous = current->getPrevNode();...
2008 Dec 19
2
[LLVMdev] llvm-c API and well formed block
How can I find out, in llvm-c API, whether a basic block is well formed? In C++ I could call getTerminator and test for NULL. -- Seo Sanghyeon
2009 May 08
2
[LLVMdev] Splitting a basic block, replacing it's terminator
Hi, I want to insert a conditional branch in the middle of a basic block. To that end, I am doing these steps: (1) Split the basic block: bb->splitBasicBlock() (2) Remove the old terminator: succ->removePredecessor(bb) bb->getTerminator()->getParent() (3) Adding a new terminator: BranchInst::Create(ifTrue, ifFalse, cnd, "", bb); That seems to work, but later passes are dieing. When I dump the function from my debugger, I notice that the new block (the second half of the block I split) has a "<null oper...
2012 Feb 08
2
[LLVMdev] BackedgeTakenCount calculation for fortran loops and DragonEgg gfortran-4.6
...larEvolution.cpp > @@ -4293,9 +4293,15 @@ ScalarEvolution::ComputeExitLimit(const Loop > *L, BasicBlock *ExitingBlock) { >   // >   // FIXME: we should be able to handle switch instructions (with a > single exit) >   BranchInst *ExitBr = dyn_cast<BranchInst>(ExitingBlock->getTerminator()); > + >   if (ExitBr == 0) return getCouldNotCompute(); >   assert(ExitBr->isConditional() && "If unconditional, it can't be in loop!"); > > +  BranchInst* BrFirstSucc = dyn_cast<BranchInst>(ExitBr-> > +                                      ...
2012 Feb 08
2
[LLVMdev] BackedgeTakenCount calculation for fortran loops and DragonEgg gfortran-4.6
....cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -4293,6 +4293,11 @@ ScalarEvolution::ComputeExitLimit(const Loop *L, BasicBlock *ExitingBlock) { // // FIXME: we should be able to handle switch instructions (with a single exit) BranchInst *ExitBr = dyn_cast<BranchInst>(ExitingBlock->getTerminator()); + BranchInst* BrFirstSucc = dyn_cast<BranchInst>(ExitBr-> + getSuccessor(0)->getTerminator()); + BranchInst* BrSecondSucc = dyn_cast<BranchInst>(ExitBr-> + getSuccessor(1)->getTer...
2012 Feb 08
0
[LLVMdev] BackedgeTakenCount calculation for fortran loops and DragonEgg gfortran-4.6
....cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -4293,9 +4293,15 @@ ScalarEvolution::ComputeExitLimit(const Loop *L, BasicBlock *ExitingBlock) { // // FIXME: we should be able to handle switch instructions (with a single exit) BranchInst *ExitBr = dyn_cast<BranchInst>(ExitingBlock->getTerminator()); + if (ExitBr == 0) return getCouldNotCompute(); assert(ExitBr->isConditional() && "If unconditional, it can't be in loop!"); + BranchInst* BrFirstSucc = dyn_cast<BranchInst>(ExitBr-> + getSuccessor(0)->g...
2012 Feb 08
2
[LLVMdev] BackedgeTakenCount calculation for fortran loops and DragonEgg gfortran-4.6
...n::ComputeExitLimit(const Loop >> > *L, BasicBlock *ExitingBlock) { >> >   // >> >   // FIXME: we should be able to handle switch instructions (with a >> > single exit) >> >   BranchInst *ExitBr = >> > dyn_cast<BranchInst>(ExitingBlock->getTerminator()); >> > + >> >   if (ExitBr == 0) return getCouldNotCompute(); >> >   assert(ExitBr->isConditional() && "If unconditional, it can't be in >> > loop!"); >> > >> > +  BranchInst* BrFirstSucc = dyn_cast<BranchInst&g...
2008 Dec 19
0
[LLVMdev] llvm-c API and well formed block
On 2008-12-19, at 09:18, Seo Sanghyeon wrote: > How can I find out, in llvm-c API, whether a basic block is well > formed? In C++ I could call getTerminator and test for NULL. There's not currently a binding for this. In general, there's incomplete support for inspection and analysis through the C bindings. BasicBlock::getTerminator() is just a convenient way to spell for dyn_cast<Terminator>(*--BB->end()). Adding bindings f...
2009 May 08
0
[LLVMdev] Splitting a basic block, replacing it's terminator
...02 PM, Nick Johnson wrote: > I want to insert a conditional branch in the middle of a basic block. > To that end, I am doing these steps: > > (1) Split the basic block: > bb->splitBasicBlock() > > (2) Remove the old terminator: > succ->removePredecessor(bb) > bb->getTerminator()->getParent() Assuming that the new block will still be a successor of the old block (just not the unique successor), all you really need to do is: BasicBlock* succ = bb->splitBasicBlock(); bb->getTerminator()->eraseFromParent(); BranchInst::Create(<ifTrue>, <if...
2010 May 04
2
[LLVMdev] Question about GVN
...; 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) { 1597 if (isa<IndirectBrInst>(Pred->getTerminator())) { 1598 DEBUG(dbgs() << "COULD NOT PRE LOAD BECAUSE OF INDBR CRITICAL EDGE '" 1599 << Pred->getName() << "': " << *LI...
2012 Feb 08
0
[LLVMdev] BackedgeTakenCount calculation for fortran loops and DragonEgg gfortran-4.6
...,9 +4293,15 @@ ScalarEvolution::ComputeExitLimit(const Loop > > *L, BasicBlock *ExitingBlock) { > > // > > // FIXME: we should be able to handle switch instructions (with a > > single exit) > > BranchInst *ExitBr = > dyn_cast<BranchInst>(ExitingBlock->getTerminator()); > > + > > if (ExitBr == 0) return getCouldNotCompute(); > > assert(ExitBr->isConditional() && "If unconditional, it can't be in > loop!"); > > > > + BranchInst* BrFirstSucc = dyn_cast<BranchInst>(ExitBr-> > > + &g...
2012 Feb 09
2
[LLVMdev] BackedgeTakenCount calculation for fortran loops and DragonEgg gfortran-4.6
...*L, BasicBlock *ExitingBlock) { >> >> >   // >> >> >   // FIXME: we should be able to handle switch instructions (with a >> >> > single exit) >> >> >   BranchInst *ExitBr = >> >> > dyn_cast<BranchInst>(ExitingBlock->getTerminator()); >> >> > + >> >> >   if (ExitBr == 0) return getCouldNotCompute(); >> >> >   assert(ExitBr->isConditional() && "If unconditional, it can't be in >> >> > loop!"); >> >> > >> >> >...
2012 Feb 08
0
[LLVMdev] BackedgeTakenCount calculation for fortran loops and DragonEgg gfortran-4.6
...> >> > *L, BasicBlock *ExitingBlock) { > >> > // > >> > // FIXME: we should be able to handle switch instructions (with a > >> > single exit) > >> > BranchInst *ExitBr = > >> > dyn_cast<BranchInst>(ExitingBlock->getTerminator()); > >> > + > >> > if (ExitBr == 0) return getCouldNotCompute(); > >> > assert(ExitBr->isConditional() && "If unconditional, it can't be in > >> > loop!"); > >> > > >> > + BranchInst* BrFirstS...
2012 Feb 09
0
[LLVMdev] BackedgeTakenCount calculation for fortran loops and DragonEgg gfortran-4.6
...ingBlock) { >>> >> >   // >>> >> >   // FIXME: we should be able to handle switch instructions (with a >>> >> > single exit) >>> >> >   BranchInst *ExitBr = >>> >> > dyn_cast<BranchInst>(ExitingBlock->getTerminator()); >>> >> > + >>> >> >   if (ExitBr == 0) return getCouldNotCompute(); >>> >> >   assert(ExitBr->isConditional() && "If unconditional, it can't be in >>> >> > loop!"); >>> >> > &g...
2012 Feb 09
1
[LLVMdev] BackedgeTakenCount calculation for fortran loops and DragonEgg gfortran-4.6
...>> >> >   // >>>> >> >   // FIXME: we should be able to handle switch instructions (with a >>>> >> > single exit) >>>> >> >   BranchInst *ExitBr = >>>> >> > dyn_cast<BranchInst>(ExitingBlock->getTerminator()); >>>> >> > + >>>> >> >   if (ExitBr == 0) return getCouldNotCompute(); >>>> >> >   assert(ExitBr->isConditional() && "If unconditional, it can't be in >>>> >> > loop!"); >>>&...
2012 Dec 17
4
[LLVMdev] BasicBlock back()
...M. I am trying to move among the instructions of a BasicBlock and I cannot. In this particular example, I try to get the previous instruction of the end instruction. I am trying 2 methods: 1. I have the following sequence of code: bool patternDC::runOnBasicBlock(BasicBlock &BB) { ... if (BB.getTerminator()) { Instruction* current = BB.getTerminator(); errs() << "\n LAST: "<<*current<<"\n"; Instruction* prev = &BB.back(); errs() << "\n PENULTIMATE: "<<*prev<<"\n"; .....
2010 Jun 25
1
[LLVMdev] redundant checking of terminator in Verifier?
...each instruction, the checking at visitTerminatorInst seems redundant to me. Did I miss any case? void Verifier::visitInstruction(Instruction &I) { ... line 1356: // Verify that if this is a terminator that it is at the end of the block. if (isa<TerminatorInst>(I)) Assert1(BB->getTerminator() == &I, "Terminator not at end of block!", &I); ... } void Verifier::visitTerminatorInst(TerminatorInst &I) { // Ensure that terminators only exist at the end of the basic block. Assert1(&I == I.getParent()->getTerminator(), "Terminator found in...
2012 Dec 20
0
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
Hello John, I was following your procedures and I isolated the problem. The problem are represented by the basic blocks with only one elements. for (Function::iterator II = F.begin(), EE = F.end(); II != EE; ++II, ++ii) { BasicBlock* BB=II; if (BB->getTerminator()) { Instruction* current = BB->getTerminator(); Instruction* previous; errs()<<"AAA\n"; if(current->getPrevNode()) { errs()<<"BBB\n"; previous = current->getPrevNode(); ok...
2011 Oct 14
0
[LLVMdev] BasicBlock succ iterator
...lock 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 *bb = dyn_cast<BasicBlock> (termInst->getOperand(i)); if (bb == header) { termInst->setOperand(i,newBlock); } } }* * cout <...