[LLVMdev] LICM ilist question.

Gang-Ryung Uh guh at boisestate.edu
Mon Jan 11 10:57:29 PST 2010


I am using LLVM 2.6 and I have a question on the use of the
BasicBlock::iterator to hoist loop invariant instructions to the loop
preheader. When I process the instructions backward as shown in the
following code, I got the following error right after the "hoist(I)" is
done. Can anyone advise whether I am misusing BasicBlock::iterator?

/opt/llvms/src/llvm_26/ include/llvm/ADT/ilist.h:213:
llvm::ilist_iterator<NodeTy>& llvm::ilist_iterator<NodeTy>::operator--()
[with NodeTy = llvm::Instruction]: Assertion `NodePtr && "--'d off the
beginning of an ilist!"' failed.


*LICM::HOistRegion(DomTreeNode *N)*
{
    assert(N != 0 && "Null dominator tree node?");
    BasicBlock *BB = N->getBlock();

    ...

   * for (BasicBlock::iterator II = BB->end(); II != BB->begin(); ) *{

               Instruction &I = *--II;

               if (isLoopInvariantInst(I) && canSinkOrHoistInst(I) &&
                    isSafeToExecuteUnconditionally(I))
                   * hoist(I);*
    }
..
}


-- UGR
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100111/7f0da2b3/attachment.html>


More information about the llvm-dev mailing list