[LLVMdev] problem with runOnLoop
Duncan Sands
baldrick at free.fr
Tue Dec 18 01:54:44 PST 2012
On 18/12/12 10:34, Alex wrote:
> John Criswell <criswell <at> illinois.edu> writes:
>
>>
>>
>> On 12/12/11 9:59 AM, neda 8664 wrote:
>>
>>
>> hi all,
>> I want access to all basic blocks of function in a loop, so I used
>> the following code:bool parallel::runOnLoop(Loop *L, LPPassManager
>> &LPM)
>> {
>> for (Function::iterator bi= func->begin(); bi !=
>> func->end(); bi++){
>> //
>> }
>> }
>>
>>
>> Are you modifying anything within this code (especially changes that
>> add/remove basic blocks or change their Terminator instructions)?
>> Depending on what you're doing, you may be invalidating the basic
>> block iterator bi.
>> -- John T.
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev <at> cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
> Hello, I am getting same opt Stack dump error frequently as well. Also trying to
> access basic blocks in runOnBasicBlock(BasicBlock &BB). This is at the 4th line
> with errs():
> Instruction* current = BB.getTerminator();
> errs() << "\n last: "<<*current<<"\n";
> Instruction* prev = current->getPrevNode();
> errs()<<*prev<<"\n";
> What can be the cause?
This will happen if the terminator was the only instruction in the basic block.
Then prev will be pointing to rubbish.
Ciao, Duncan.
More information about the llvm-dev
mailing list