Displaying 12 results from an estimated 12 matches for "getbasicblockindex".
2012 Dec 21
0
[LLVMdev] LLVM getBasicBlockIndex() or equivalent
Hello everyone !
I have some problems of getting the index of a basic block.
for (Function::iterator II = F.begin(), EE = F.end(); II != EE; ++II, ++ii)
{ BasicBlock* BB=II;
I have segfaults or cannot use complex structures of several methods that I
found in LLVM. Do you know how to use as simply as possible the methods
found at :
http://llvm.org/doxygen/Instructions_8h_source.html#l02136
2011 Feb 01
0
[LLVMdev] Loop simplification
...oming(phi, *pi);
}
}
}
// Update successor PHIs
for (BasicBlock::iterator it = succ->begin();
succ->getFirstNonPHI() != it; ++it)
{
PHINode *phi = dyn_cast<PHINode>(it);
UT_ASSERT(phi);
UT_ASSERT(phi->getBasicBlockIndex(pred) >= 0);
Value *val = phi->getIncomingValueForBlock(pred);
PHINode *predphi = dyn_cast<PHINode>(val);
if (predphi && predphi->getParent() != pred)
predphi = 0;
phi->removeIncomingValue(pred, false);
for (p...
2012 Mar 08
2
[LLVMdev] Updating value from PHI
...(II)); ++II) {
// remove loop back PHI and add it to split BB
errs()<<*II<<"\n";
PHINode *newPHIvalue = PHINode::Create(PN->getType(), 2,
PN->getName().str(), splitBB->getFirstInsertionPt());
int IDX = PN->getBasicBlockIndex(splitBB);
while (IDX != -1) {
Value *oldValue = PN->getIncomingValue((unsigned(IDX)));
PN->removeIncomingValue(IDX, false);
newPHIvalue->addIncoming(oldValue, loopLatchBB);
newPHIvalue->addIncoming(PN...
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
2012 Mar 08
0
[LLVMdev] Updating value from PHI
...// remove loop back PHI and add it to split BB
> errs()<<*II<<"\n";
> PHINode *newPHIvalue = PHINode::Create(PN->getType(), 2,
> PN->getName().str(), splitBB->getFirstInsertionPt());
> int IDX = PN->getBasicBlockIndex(splitBB);
> while (IDX != -1) {
> Value *oldValue = PN->getIncomingValue((unsigned(IDX)));
> PN->removeIncomingValue(IDX, false);
> newPHIvalue->addIncoming(oldValue, loopLatchBB);
> newPH...
2005 Jul 29
0
[LLVMdev] patch for pointer-to-array conversion
...de *PN,
- BasicBlock *Preheader,
- std::set<Instruction*>
&DeadInsts) {
- assert(PN->getNumIncomingValues() == 2 && "Noncanonicalized loop!");
- unsigned PreheaderIdx = PN->getBasicBlockIndex(Preheader);
- unsigned BackedgeIdx = PreheaderIdx^1;
- if (GetElementPtrInst *GEPI =
- dyn_cast<GetElementPtrInst>(PN->getIncomingValue(BackedgeIdx)))
- if (GEPI->getOperand(0) == PN) {
- assert(GEPI->getNumOperands() == 2 && "GEP types must mismatch!"...
2012 Mar 08
0
[LLVMdev] Updating value from PHI
I have attached a case of what I am trying to do, I'm pretty sure I'm just
missing some simple API call. In the cfg you can see that although Im
setting "lsr.iv441" as "lsr.iv44" from for.body.387.i it's not propagating
that through the block or graph.
On Wed, Mar 7, 2012 at 12:03 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> I am splitting a one BB
2018 May 24
0
LLVM Pass To Remove Dead Code In A Basic Block
> On 25 May 2018, at 01:46, Aaron via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Hi all,
>
> LLVM optimization pass gives an error "Terminator found in the middle of a basic block!" since basic block IR may have multiple "ret" instructions. It seems LLVM does not accept multiple return in a basic block by default.
>
Yes, if you’re inserting
2018 May 24
2
LLVM Pass To Remove Dead Code In A Basic Block
Hi all,
LLVM optimization pass gives an error "Terminator found in the middle of a
basic block!" since basic block IR may have multiple "ret" instructions. It
seems LLVM does not accept multiple return in a basic block by default.
Is there a specific optimization or pass that I can enable to remove
unreachable codes in basic blocks?
Best,
Aaron
-------------- next part
2012 Mar 07
4
[LLVMdev] Updating value from PHI
I am splitting a one BB loop into two BB.
Basically, the one loop BB has 3 incoming values, one form back edge two
from other edges. I want to extract the PHIs from the other two edges out
into it's own BB and delete that from the loop, then redirect the backedge
to the loopbody (non extracted portion) and create a new PHI coming from
the extracted BB and the backedge.
I can do this;
2018 May 24
2
LLVM Pass To Remove Dead Code In A Basic Block
...in(newBlock), E =
llvm::succ_end(newBlock); I != E; ++I)
{
// Loop over any phi nodes in the basic block, updating the BB
field of
// incoming values...
llvm::BasicBlock *Successor = *I;
for (auto &PN : Successor->phis())
{
int Idx = PN.getBasicBlockIndex(basicBlock);
while (Idx != -1)
{
PN.setIncomingBlock((unsigned)Idx, newBlock);
Idx = PN.getBasicBlockIndex(basicBlock);
}
}
}
return newBlock;
}
Best,
Aaron
On Thu, May 24, 2018 at 9:22 AM, Dean Michael Berris...
2006 May 17
0
[LLVMdev] Obfuscation with LLVM
...esponding incoming value in the
PHI node
// as new incoming undefined value to the PHI node.
int wasIncomingCount = 0;
for( pred_iterator pred = pred_begin( dispatcherBB ); pred !=
pred_end( dispatcherBB ); pred++ )
{
int idx = phi->getBasicBlockIndex( *pred );
if( idx == -1 )
{
phi->addIncoming( UndefValue::get( phi->getType() ),
*pred );
}
else
{
wasIncomingCount++;
}
}
assert( wa...