This is an archive of the discontinued LLVM Phabricator instance.

[PIR] Add ParallelRegionInfoPass that builds the parallel region tree
Needs ReviewPublic

Authored by jdoerfert on Feb 24 2017, 2:15 PM.

Details

Summary
The parallel region info (PRI) identifies and creates parallel
regions. It also serves as a verifier in case parallel instructions
are not used properly.

Currently the parallel region info is "lazy" in the sense that it does
only need to be updated if new parallel regions are created (or
deleted). As this should not happen very often (and only in very few
places) it allows transformation passes to preserve the parallel
region info without modifications. Additionally, it makes the analysis
very lightweight in the absence of parallel regions (which should be
the majority of functions).

The drawback for passes that need to deal with parallel regions
explicitly is the absence of a mapping from basic blocks to parallel
regions. For now these passes can use the createMapping() function to
generate such a mapping on-demand. After integration of parallel
regions a separate function pass could be introduced to maintain this
mapping and recompute it if it was not preserved by a transformation.
However, at the moment there are only a small number of places that
require it but a lot of transformations that would need to be modified
to preserve it.

@TODO The update interface to add/remove parallel regions is missing.