[LLVMdev] problem with runOnLoop

John Criswell criswell at illinois.edu
Mon Dec 12 08:12:08 PST 2011


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.

>
> First loop run without problem, but for second loop I get the 
> following error:
>
> /0 libLLVM-2.9.so <http://libLLVM-2.9.so> 0x0137d530
> 1 libLLVM-2.9.so <http://libLLVM-2.9.so> 0x0137fa6c
> 2                 0x002a7400 __kernel_sigreturn + 0
> 3  parallel.so    0x002895e9 parallel::runOnLoop(llvm::Loop*, 
> llvm::LPPassManager&) + 345
> 4 libLLVM-2.9.so <http://libLLVM-2.9.so> 0x00982994 
> llvm::LPPassManager::runOnFunction(llvm::Function&) + 1156
> 5 libLLVM-2.9.so <http://libLLVM-2.9.so> 0x00eb02c1 
> llvm::FPPassManager::runOnFunction(llvm::Function&) + 545
> 6 libLLVM-2.9.so <http://libLLVM-2.9.so> 0x00eb03d7 
> llvm::FPPassManager::runOnModule(llvm::Module&) + 87
> 7 libLLVM-2.9.so <http://libLLVM-2.9.so> 0x00eafde5 
> llvm::MPPassManager::runOnModule(llvm::Module&) + 517
> 8 libLLVM-2.9.so <http://libLLVM-2.9.so> 0x00eaff8b 
> llvm::PassManagerImpl::run(llvm::Module&) + 171
> 9 libLLVM-2.9.so <http://libLLVM-2.9.so> 0x00eb008d 
> llvm::PassManager::run(llvm::Module&) + 45
> 10 opt            0x0805b32f main + 5295
> 11 libc.so.6      0x002becc6 __libc_start_main + 230
> 12 opt            0x0804ff51
> Stack dump:
> 0.    Program arguments: opt -dse -lda -memdep -basicaa -libcall-aa 
> -scev-aa -globalsmodref-aa -load 
> /home/llvm/src/Release+Debug+Profile+Asserts/lib/parallel.so -parallel 
> -dot-cfg obj.o -o out.o
> 1.    Running pass 'Function Pass Manager' on module 'obj.o'.
> 2.    Running pass 'Loop Pass Manager' on function '@main'
> 3.    Running pass 'parallel World Pass' on basic block '%bb4'
> Segmentation fault (core dumped)/
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111212/a83f5c88/attachment.html>


More information about the llvm-dev mailing list