search for: getfirstnonphi

Displaying 20 results from an estimated 20 matches for "getfirstnonphi".

2006 Jun 04
3
[LLVMdev] [PATCH] BasicBlock::getFirstNonPHI
...e one has to add instruction at the beginning of a basic block, one has to skip past PHI nodes that are already there. How about adding a new method to BasicBlock, to get that first non-PHI instruction? So, adding an instruction will be as simple as: new SomeInstruction(............., BB->getFirstNonPHI()) Patch attached. Comments? - Volodya -------------- next part -------------- A non-text attachment was scrubbed... Name: BasicBlock.diff Type: text/x-diff Size: 1679 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060604/de97f530/attachment.diff>
2006 Jun 04
0
[LLVMdev] [PATCH] BasicBlock::getFirstNonPHI
...ction at the beginning of a basic block, one > has to skip past PHI nodes that are already there. How about adding a new > method to BasicBlock, to get that first non-PHI instruction? So, adding an > instruction will be as simple as: > > new SomeInstruction(............., BB->getFirstNonPHI()) Sure, sounds good. A couple requests: 1. Please add a const version that returns a const Instruction* also. 2. There is no need to check for running off the end of the basic block, you are guaranteed that a block has a terminator, which is not a PHI. -Chris -- http://nondot.org/sabre/ htt...
2006 Jun 05
2
[LLVMdev] Re: [PATCH] BasicBlock::getFirstNonPHI
...ng of a basic block, >> one has to skip past PHI nodes that are already there. How about adding a >> new method to BasicBlock, to get that first non-PHI instruction? So, >> adding an instruction will be as simple as: >> >> new SomeInstruction(............., BB->getFirstNonPHI()) > > Sure, sounds good. A couple requests: > > 1. Please add a const version that returns a const Instruction* also. I was considering it, but then decided that given that you can't pass 'const Instruction*' as 'insert before' parameter of any other instruction...
2006 Jun 06
0
[LLVMdev] Re: [PATCH] BasicBlock::getFirstNonPHI
...t; > I was considering it, but then decided that given that you can't pass 'const > Instruction*' as 'insert before' parameter of any other instruction, > there's no point in adding it. Ok, that makes sense. > Maybe, the method should be > > Instruction* getFirstNonPHI() const > > ? Given that in C++ constness is generally not deep -- i.e. don't apply to > contained objects. True, but that would break "logical constness" which is more useful. :) I'd prefer either two versions or just the single non-const version. Thanks, -Chris --...
2006 Jun 04
1
[LLVMdev] [PATCH] BasicBlock::getFirstNonPHI
...> block, one >> has to skip past PHI nodes that are already there. How about adding a new >> method to BasicBlock, to get that first non-PHI instruction? So, >> adding an >> instruction will be as simple as: >> >> new SomeInstruction(............., BB->getFirstNonPHI()) > > 2. There is no need to check for running off the end of the basic block, > you are guaranteed that a block has a terminator, which is not a PHI. Assuming it's a valid BasicBlock. Which, if I understand correctly, isn't always true in mid-transformation. Perhaps you should...
2011 Feb 01
0
[LLVMdev] Loop simplification
...#39;ve got so far - it seems to work, aside from the fact that DeleteDeadPHIs is not removing at least one dead PHI in my test program. --------------------- static bool mergeBlockIntoSuccessor(BasicBlock *pred, BasicBlock *succ) { if (succ == pred) return false; if (pred->getFirstNonPHI() != pred->getTerminator()) return false; // Delete the terminator in the predecessor block pred->getTerminator()->eraseFromParent(); // Update predecessor PHIs for (BasicBlock::iterator it = pred->begin(); it != pred->end(); ++it) {...
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
2019 Apr 01
2
Instruction Execution With Hard Limitation at Runtime
I am trying to give a quota of how many instructions can be run to a program. So create a simple function as below: define void @add_gas(i64 %gasCost) { __virtual_entry: %0 = load i64, i64* @__WAVM__XX__gGasUsed ### I am sure it exists, same as the __WAVM__XX__gGasLimit %addtmp = add i64 %0, %gasCost %1 = load i64, i64* @__WAVM__XX__gGasLimit %cmptmp = icmp sgt i64 %addtmp, %1 br i1
2012 Dec 24
0
[LLVMdev] Can simplifycfg kill llvm.lifetime intrinsics?
...(Succ->getSinglePredecessor()) { // BB is the only predecessor of Succ, so Succ will end up with exactly // the same predecessors BB had. // Copy over any phi, debug or lifetime instruction. BB->getTerminator()->eraseFromParent(); Succ->getInstList().splice(Succ->getFirstNonPHI(), BB->getInstList()); } does this only when successor of basic block being removed has a single predecessor. This is not the case even for simple test in /test/Transforms/SimplifyCFG/lifetime.ll. That said, I think for now we should just apply the patch attached to this mail. Please take a...
2008 Mar 04
0
[LLVMdev] Deleting Instructions after Intrinsic Creation
...%migrate_begin ) ; <i1> [#uses=1] br i1 %migrate_end1, label %bb.i, label %bb10.i ------------------------------------------------------------------------------------------------------------- Section of code used to delete instructions: for(BasicBlock::iterator i= bbp->getFirstNonPHI(),ie=bbp->end();i!=ie;++i){ if(!((i->isTerminator()) || (isa<CallInst>(i)))) {i->dropAllReferences(); } } for(BasicBlock::iterator bi= bbp->getFirstNonPHI(),ie=bbp->end();bi!=ie;++bi){ if((*bi).getNumOperands()==0) {(*bi).eraseFromParent();} } --------------------------...
2008 Mar 04
1
[LLVMdev] Deleting Instructions after Intrinsic Creation
...%migrate_begin ) ; <i1> [#uses=1] br i1 %migrate_end1, label %bb.i, label %bb10.i ------------------------------------------------------------------------------------------------------------- Section of code used to delete instructions: for(BasicBlock::iterator i= bbp->getFirstNonPHI(),ie=bbp->end();i!=ie;++i){ if(!((i->isTerminator()) || (isa<CallInst>(i)))) {i->dropAllReferences();} } for(BasicBlock::iterator bi= bbp->getFirstNonPHI(),ie=bbp->end();bi!=ie;++bi){ if((*bi).getNumOperands()==0) {(*bi).eraseFromParent();} } -----------------------------...
2012 Dec 17
2
[LLVMdev] Can simplifycfg kill llvm.lifetime intrinsics?
Hi! I'm working on ASan option that uses llvm.lifetime intrinsics to detect use-after-scope bugs. In short, the idea is to insert calls into ASan runtime that would mark the memory as "addressable" or "unaddressable". I see the following problem with the following "trivial" basic block: for.body.lr.ph.i: ; preds = %for.body.i310
2012 Dec 25
3
[LLVMdev] Can simplifycfg kill llvm.lifetime intrinsics?
...r()) { > // BB is the only predecessor of Succ, so Succ will end up with exactly > // the same predecessors BB had. > > // Copy over any phi, debug or lifetime instruction. > BB->getTerminator()->eraseFromParent(); > Succ->getInstList().splice(Succ->getFirstNonPHI(), BB->getInstList()); > } > > does this only when successor of basic block being removed has a single > predecessor. > This is not the case even for simple test in > /test/Transforms/SimplifyCFG/lifetime.ll. > > That said, I think for now we should just apply the patch...
2013 Aug 19
4
[LLVMdev] Generating GetElementPtr inlined in a function argument list programmatically
...lue*> indices;indices.push_back(ConstantInt::get(IntegerType::getInt32Ty(getGlobalContext()), 0));indices.push_back(ConstantInt::get(IntegerType::getInt32Ty(getGlobalContext()), 0));GetElementPtrInst* gep_str = GetElementPtrInst::CreateInBounds(global_str_ptr, indices, "bbname", bb->getFirstNonPHI());args.push_back(gep_str);args.push_back(ConstantInt::get(IntegerType::getInt32Ty(getGlobalContext()), size));CallInst* inc_call = CallInst::Create(func_incrementFaultSitesEnumerated, args, "", first_inst);------------------------------------------------------------------- Thanks in adva...
2012 Oct 26
2
[LLVMdev] instr_iterator
Is it safe or legal to call isInsideBundle even when I == E? MachineBasicBlock::iterator MachineBasicBlock::getFirstNonPHI() { instr_iterator I = instr_begin(), E = instr_end(); while (I != E && I->isPHI()) ++I; assert(!I->isInsideBundle() && "First non-phi MI cannot be inside a bundle!"); return I; } I am seeing an assert when I run llc. The code is in lib/CodeGen/MachineBa...
2013 Aug 19
0
[LLVMdev] Generating GetElementPtr inlined in a function argument list programmatically
....push_back(ConstantInt::get(IntegerType::getInt32Ty(getGlobalContext()), 0)); > indices.push_back(ConstantInt::get(IntegerType::getInt32Ty(getGlobalContext()), 0)); > GetElementPtrInst* gep_str = GetElementPtrInst::CreateInBounds(global_str_ptr, > indices, > "bbname", bb->getFirstNonPHI()); > args.push_back(gep_str); > args.push_back(ConstantInt::get(IntegerType::getInt32Ty(getGlobalContext()), > size)); > CallInst* inc_call = CallInst::Create(func_incrementFaultSitesEnumerated, args, > "", first_inst); > ----------------------------------------------...
2012 Dec 20
1
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
I solved by checking if(BB->size()>1) Thank you all for the help ! Now debugging the next segfault. On Thu, Dec 20, 2012 at 12:59 PM, Alexandru Ionut Diaconescu < alexandruionutdiaconescu at gmail.com> wrote: > getPrevNode<http://llvm.org/docs/doxygen/html/classllvm_1_1ilist__node.html#a77b897207ef0a1ae95c404695aed9a4b>() > Get the previous node, or 0 for the list
2019 Jun 27
3
How to the get the PHI Nodes in a basic block?
Hi all, I have an Instruction object I from where I can correctly obtain the parent doing I.getParent(). Now I would like to understand how to obtain the PHI Nodes in that block. Do you suggest to iterate all over the instructions since the PHI nodes are always at the beginning or should I use another approach? What the best way to iterate over the instructions in a block? Thanks Alberto
2012 Dec 25
0
[LLVMdev] Can simplifycfg kill llvm.lifetime intrinsics?
...nly predecessor of Succ, so Succ will end up with > exactly > > // the same predecessors BB had. > > > > // Copy over any phi, debug or lifetime instruction. > > BB->getTerminator()->eraseFromParent(); > > Succ->getInstList().splice(Succ->getFirstNonPHI(), > BB->getInstList()); > > } > > > > does this only when successor of basic block being removed has a single > > predecessor. > > This is not the case even for simple test in > > /test/Transforms/SimplifyCFG/lifetime.ll. > > > > That said, I...
2013 Mar 02
2
[LLVMdev] Question about method CodeExtractor::severSplitPHINodes
...lues from outside of the region, and a00211 // second that contains all of the code for the block and merges back any00212 // incoming values from inside of the region.00213 BasicBlock::iterator <http://llvm.org/docs/doxygen/html/classllvm_1_1ilist__iterator.html> AfterPHIs = Header->getFirstNonPHI <http://llvm.org/docs/doxygen/html/classllvm_1_1BasicBlock.html#a0e73f4e09745bb69fdd7b15232c45428>();00214 BasicBlock <http://llvm.org/docs/doxygen/html/classllvm_1_1BasicBlock.html> *NewBB = Header->splitBasicBlock <http://llvm.org/docs/doxygen/html/classllvm_1_1BasicBlock.html...