<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 12/12/11 9:59 AM, neda 8664 wrote:
    <blockquote
cite="mid:CAHbEVmQ0zz0DP5_wSPaV27G2dc-hS4jasM6OS_kOadBkVQB0aQ@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      hi all,<br>
      <br>
      I want access to all basic blocks of function in a loop, so I used
      the following code:<br>
      <br>
      <font size="1"><i>bool parallel::runOnLoop(Loop *L, LPPassManager
          &LPM)<br>
          {<br>
              for (Function::iterator bi= func->begin(); bi !=
          func->end(); bi++){<br>
                 //<br>
               }<br>
          }</i></font><br>
    </blockquote>
    <br>
    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.<br>
    <br>
    -- John T.<br>
    <br>
    <blockquote
cite="mid:CAHbEVmQ0zz0DP5_wSPaV27G2dc-hS4jasM6OS_kOadBkVQB0aQ@mail.gmail.com"
      type="cite"><br>
      First loop run without problem, but for second loop I get the
      following error:<br>
      <br>
      <i><font size="1">0  <a moz-do-not-send="true"
            href="http://libLLVM-2.9.so">libLLVM-2.9.so</a> 0x0137d530<br>
          1  <a moz-do-not-send="true" href="http://libLLVM-2.9.so">libLLVM-2.9.so</a>
          0x0137fa6c<br>
          2                 0x002a7400 __kernel_sigreturn + 0<br>
          3  parallel.so    0x002895e9 parallel::runOnLoop(llvm::Loop*,
          llvm::LPPassManager&) + 345<br>
          4  <a moz-do-not-send="true" href="http://libLLVM-2.9.so">libLLVM-2.9.so</a>
          0x00982994
          llvm::LPPassManager::runOnFunction(llvm::Function&) + 1156<br>
          5  <a moz-do-not-send="true" href="http://libLLVM-2.9.so">libLLVM-2.9.so</a>
          0x00eb02c1
          llvm::FPPassManager::runOnFunction(llvm::Function&) + 545<br>
          6  <a moz-do-not-send="true" href="http://libLLVM-2.9.so">libLLVM-2.9.so</a>
          0x00eb03d7 llvm::FPPassManager::runOnModule(llvm::Module&)
          + 87<br>
          7  <a moz-do-not-send="true" href="http://libLLVM-2.9.so">libLLVM-2.9.so</a>
          0x00eafde5 llvm::MPPassManager::runOnModule(llvm::Module&)
          + 517<br>
          8  <a moz-do-not-send="true" href="http://libLLVM-2.9.so">libLLVM-2.9.so</a>
          0x00eaff8b llvm::PassManagerImpl::run(llvm::Module&) + 171<br>
          9  <a moz-do-not-send="true" href="http://libLLVM-2.9.so">libLLVM-2.9.so</a>
          0x00eb008d llvm::PassManager::run(llvm::Module&) + 45<br>
          10 opt            0x0805b32f main + 5295<br>
          11 libc.so.6      0x002becc6 __libc_start_main + 230<br>
          12 opt            0x0804ff51<br>
          Stack dump:<br>
          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<br>
          1.    Running pass 'Function Pass Manager' on module 'obj.o'.<br>
          2.    Running pass 'Loop Pass Manager' on function '@main'<br>
          3.    Running pass 'parallel World Pass' on basic block '%bb4'<br>
          Segmentation fault (core dumped)</font></i><br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>