<div dir="ltr">Hi Fellows, <div><br></div><div>   I notice an unexpected behavior in RegionInfo's block_iterator. Consider the following situation: a user creates her own region containing just a single basic block TheBB, then tries to have the block_iterator to print a DFS traversal of the region. The expected behavior should be that only the single basic block TheBB will be printed, but the real behavior is that block_iterator prints out all the basic blocks of the CFG starting from TheBB to the end. </div>
<div><br></div><div>    It looks like the issue originates from setting the end iterator to (BasicBlock *) 0. I understand that the "region" detected by RegionInfo should never contain a single basic block or even a sequence of basic blocks. So maybe the above degenerated case is considered "will never happen"?</div>
<div><br></div><div>    ... ...</div><div><br></div><div>    BasicBlock *BB = Func.getARandomBasicBlock;</div><div><br></div><div>    Region *R = new Region(BB, BB, RI, DT); </div><div>    for (Region::block_iterator i = R->block_begin(), <br>
</div>
<div>           e = R->block_end(); i != e; ++i) {</div><div>         errs() << (*i)->getName() << "\n";        </div><div>      }</div><div><br></div><div>      ... ...</div><div><br></div><div>
<br></div><div><br></div><div>Best Regards,</div><div>Paul</div></div>