<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 2, 2014 at 5:30 PM, Tobias Grosser <span dir="ltr"><<a href="mailto:tobias@grosser.es" target="_blank">tobias@grosser.es</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 03/05/2014 00:15, Paul Vario wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Tobias,<br>
<br>
Thanks so much for the quick response. Your approach fixes the issue.<br>
On a bigger context, would it make more sense to make the region exit<br>
part of the region? For example, a while loop gets lowered down to LLVM IR<br>
contains while.cond, while.body and while.end. If one tries to use<br>
RegionInfo as a substitute for structural analysis, she might think<br>
while.end should belong to the region/structure ... is it necessary to<br>
exclude the exit from being part of the region or both ways are equally<br>
correct in terms of uniquely representing regions?<br>
</blockquote>
<br></div>
The region provides both the exiting blocks as well as the exit block. So you should have all you need, no?<br></blockquote><div>Yes, the region interface suffices all my needs. It just does not contain an "iterator" that can iterate all the basic blocks </div>
<div>in the region plus the exit at once. What I usually do, under this kind of situation, is to define a std::vector of basicblocks, </div><div>push all the basic blocks in the region using block_iterator in a for loop. And then, at the end, push_back(region->getExit()).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
An example, where it is beneficial to use the block after the region as to define a region is the following:<br>
<br>
IF-1<br>
/ \<br>
| IF-2<br>
| / \<br>
| | |<br>
\ | /<br>
\ | /<br>
\|/<br>
END<br>
<br>
Here, we would like to model two regions IF-1 => END and IF-2 => END. The first region contains IF-1 and IF-2, the second one just IF-2. Obviously, neither of these regions has a single exit edge, but for both it is possible to create a single exit edge by introducing two<br>
new basic blocks on the outgoing edges of each region.<br>
<br>
Cheers,<br>
Tobias<br>
</blockquote></div>Got it! Thanks for the example.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Best,</div><div class="gmail_extra">Paul</div></div>