Hi,<br>I want to write a pass that pulls single-entry a single-exit (SESE) region into a function.<br>The idea is similar to extracting a loop in LoopExtractor.cpp.<br><br>Basically, for each region that meet our criteria,<br>
1. Find all basic blocks in that regions<br>2. Call llvm::ExtractCodeRegion() to replace that region by a call to the extracted function.<br>3. Delete the region from the RegionPassManager queue<br>4. Update the RegionInfo to reflect the change<br>
<br>To find all basic blocks (step 1), I use Region::block_iterator().<br>However, after changing the CFG, that block_iterator does not seem to work anymore.<br><br>Should I add a list of basic blocks for each Region like what people did with Loop?<br>
<br>Thank you.<br><br>