[llvm-commits] Contributing RegionInfo analysis pass

Tobias Grosser grosser at fim.uni-passau.de
Wed Jul 14 04:59:27 PDT 2010


Hi,

I would like to propose a new analysis pass for LLVM. It was developed
by ether and me.

What is it?
=======================================================================
It is called RegionInfo and calculates the (refined) single entry single
exit regions of a function. A simple region is a subgraph of the CFG,
that is connected to the remaining CFG by only two edges, an incoming
(entry) and an outgoing (exit) edge.
Such regions can be analyzed/optimized independently of the remaining
CFG. Algorithms can therefore filter out regions they cannot handle or
they can only optimize regions that match a certain criteria (well
structured, side effect free, ...).
Furthermore it might be possible to use regions to improve performance
by running algorithms in a divide and conquer style on the region tree.
The original idea was taken from "The Program Structure Tree - Richard
Johnson, David Pearson, Keshav Pingali - 1994", however enriched with
ideas from "The Refined Process Structure Tree - Jussi Vanhatalo, Hagen
Voelyer, Jana Koehler - 2009".
There are two main differences to the classical Program Structure Tree.
First of all the algorithm takes advantage of the dominance information.
I believe it is easier to understand.
Furthermore so called refined regions are detected. These are subgraphs
that do not have a single entry or exit edge, but can easily be
transformed to have one. Refined regions allow a more fine grained analysis.
========================================================================

How was it tested?
========================================================================
There is a small test suite included in the patchset. Furthermore, it
was run on the llvm/test-suite as well as the whole SPEC 2006 benchmark
suite as well as the polyhedron.com fortran benchmarks.

The pass was tested on an cmake and autoconf build using
gcc. As well as using clang on a cmake build. (all amd64-linux)

Furthermore, an analysis was done that showed the runtime is on all test
cases in the order of magnitude of dominance calculation (on a
Release-Asserts build on linux amd64).
Furthermore, it was shown that the refined region support enables the
analysis to detect over three times more regions in average.
=======================================================================

Is it already used?
=======================================================================
ether and me use the analysis pass in polly[2] to detect the static
control parts, the regions that can be analyzed and optimized with
polyhedral optimizations.
As the RegionInfo pass is used almost unchanged (except small bug fixes)
since April, it got some regular testing during the development of polly.
=======================================================================

Where to get more information?
=======================================================================
* Wiki page
http://wiki.llvm.org/RegionInfo
It that contains some further explanations and some nice graphs.

* Doxygen of the patch
http://tobias.osaft.eu/regioninfo/doxygen/annotated.html

* Coverage
http://tobias.osaft.eu/regioninfo/coverage/RegionInfo.cpp.html

* Runtime / Number of regions found
http://wiki.llvm.org/RegionInfo#Analysis
=======================================================================

I want to try it?
=======================================================================
Just run it on a test case or any other llvm-ir file.

#> opt -regions analyze test/Analyze/RegionInfo/mix_1.ll
[0] 0 => <Function Return>
  [1] 8 => 10
    [2] 11 => 14
  [1] 0 => 15
    [2] 1 => 7

To get a graphical graphviz/dot output use:
#> opt -view-regions-only test/Analyze/RegionInfo/mix_1.ll
=======================================================================

The patch?
=======================================================================
Attached. Any comments are highly appreciated.

The patch only contains the RegionInfo pass itself, the test cases as
well as the graphviz RegionViewer/RegionPrinter. The RegionPass
framework, that was also developed, is not contained. We
may contribute this later.
=======================================================================

Thanks for reviewing the patch

Cheers
Tobi

[1] http://wiki.llvm.org/Polyhedral_optimization_framework
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: regioninfo.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100714/a09ce04d/attachment.ksh>


More information about the llvm-commits mailing list