<div>
                    Hello Duncan,
                </div><div><br></div><div>Thank you for the reply; I could now see what was wrong in my case: I'm cloning some instructions from the CFG to work with them, without risking to broke any blocks in the CFG. It appears that when some of these cloned instructions were branches, they still were referring to the original CFG's basic blocks (increasing their predecessors list), even though I added them to a different function in a different module.</div><div><br></div><div>Thanks again,</div>
                <div><div><br></div><div>-- </div><div>Cristianno Martins</div><div>PhD Student of Computer Science</div><div>University of Campinas</div><div>cmartins@ic.unicamp.br</div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Wednesday, 4 de April de 2012 at 03:37, Duncan Sands wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>Hi Cristianno,</div><div><br></div><blockquote type="cite"><div><div>I'm trying to get a list of predecessors of a BasicBlock. I'm using a code</div><div>similar to that on here</div><div><<a href="http://llvm.org/docs/ProgrammersManual.html#iterate_preds">http://llvm.org/docs/ProgrammersManual.html#iterate_preds</a>>, but it appears to</div><div>be more nodes been iterating that it should. Now, when I print out the llvm IR,</div><div>I get something like:</div><div>[…]</div><div>while.body: ; preds = %7, %while.cond</div><div>[…]</div><div>for a code that have only a while loop. Ok, I can recognize the %while.cond</div><div>block on the code, but the %7 block seems to be an extra BasicBlock (I mean, it</div><div>is not directly represented in the IR)</div></div></blockquote><div><br></div><div>what do you mean by "is not directly represented in the IR"?  Do you mean that</div><div>if you dump the IR for function then it is not there?  If so, probably there is</div><div>a basic block that wasn't properly added to the function (i.e. doesn't have the</div><div>function as its parent), in which case most likely you have written your own</div><div>pass and made a mistake in your basic block manipulation.  If you mean that the</div><div>basic block is there but is lacking a label like "while.cond" then that is</div><div>normal: labels are entirely optional.  The start of a basic block is not</div><div>defined by a label, it is defined by the end of the previous basic block, which</div><div>itself is defined by the presence of a terminator instruction.</div><div><br></div><div>Ciao, Duncan.</div><div><br></div><div>  that holds only a copy of the branch</div><blockquote type="cite"><div><div>instruction that ends the %while.cond block.</div><div><br></div><div>Here is the question: is there any way that I could discard these blocks that</div><div>are not represented in the IR?</div><div><br></div><div>Thanks in advance,</div><div><br></div><div>--</div><div>Cristianno Martins</div><div>PhD Student of Computer Science</div><div>University of Campinas</div><div><a href="mailto:cmartins@ic.unicamp.br">cmartins@ic.unicamp.br</a></div><div><br></div><div><br></div><div>_______________________________________________</div><div>LLVM Developers mailing list</div><div>LLVMdev@cs.uiuc.edu         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a></div><div><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div></div></blockquote><div><br></div><div>_______________________________________________</div><div>LLVM Developers mailing list</div><div>LLVMdev@cs.uiuc.edu         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a></div><div><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>