[LLVMdev] Preserve RegionInfo after regionsimplify

Tobias Grosser grosser at fim.uni-passau.de
Thu Feb 3 12:12:59 PST 2011


On 02/03/2011 02:59 PM, Vu Le wrote:
> Hi Tobias,
> My RegionSimplify pass adds new exit node for refined regions to convert
> them into simple region.
> However, the RegionInfo pass does not seem to recognize those changes.
> For example, in the attached file, bb4.region is supposed to be in the
> first region.
>
> My RegionExtractor pass required the extracted region to be simple.
> Should we modify RegionInfo or is their away to preserve the RegionInfo
> from RegionSimplify and pass it to RegionExtractor?

RegionInfo only detects canonical regions and the region containing 
bb4.region is not canonical any more. So if the RegionInfo is 
recalculated from scratch it might again contain non simple regions.

I see two approaches:

* Define a RegionInfo pass that detects only simple regions. This can be 
used to recalculate the region tree from the CFG. If we only take simple 
regions into account, the region you want to have is canonical.

* Preserve the RegionInfo after your RegionSimplify pass. In your 
RegionSimplify pass you already create a RegionTree that only contains
simple regions. Just state that your pass preserves RegionInfo and 
DominatorTree and there is no need to recalculate RegionInfo.

I believe approach two is probably the easiest.

Check 'opt -debug-pass=Structure -regionsimplify -regionextractor 
file..' and see if the RegionInfo is recalulated. Try to not recalculate it.

Tobi



More information about the llvm-dev mailing list