llvm-project/polly
Tobias Grosser d840fc7277 Support accesses with differently sized types to the same array
This allows code such as:

void multiple_types(char *Short, char *Float, char *Double) {
  for (long i = 0; i < 100; i++) {
    Short[i] = *(short *)&Short[2 * i];
    Float[i] = *(float *)&Float[4 * i];
    Double[i] = *(double *)&Double[8 * i];
  }
}

To model such code we use as canonical element type of the modeled array the
smallest element type of all original array accesses, if type allocation sizes
are multiples of each other. Otherwise, we use a newly created iN type, where N
is the gcd of the allocation size of the types used in the accesses to this
array. Accesses with types larger as the canonical element type are modeled as
multiple accesses with the smaller type.

For example the second load access is modeled as:

  { Stmt_bb2[i0] -> MemRef_Float[o0] : 4i0 <= o0 <= 3 + 4i0 }

To support code-generating these memory accesses, we introduce a new method
getAccessAddressFunction that assigns each statement instance a single memory
location, the address we load from/store to. Currently we obtain this address by
taking the lexmin of the access function. We may consider keeping track of the
memory location more explicitly in the future.

We currently do _not_ handle multi-dimensional arrays and also keep the
restriction of not supporting accesses where the offset expression is not a
multiple of the access element type size. This patch adds tests that ensure
we correctly invalidate a scop in case these accesses are found. Both types of
accesses can be handled using the very same model, but are left to be added in
the future.

We also move the initialization of the scop-context into the constructor to
ensure it is already available when invalidating the scop.

Finally, we add this as a new item to the 2.9 release notes

Reviewers: jdoerfert, Meinersbur

Differential Revision: http://reviews.llvm.org/D16878

llvm-svn: 259784
2016-02-04 13:18:42 +00:00
..
cmake Compile ISL into its own library 2015-09-24 11:30:22 +00:00
docs Support accesses with differently sized types to the same array 2016-02-04 13:18:42 +00:00
include/polly Support accesses with differently sized types to the same array 2016-02-04 13:18:42 +00:00
lib Support accesses with differently sized types to the same array 2016-02-04 13:18:42 +00:00
test Support accesses with differently sized types to the same array 2016-02-04 13:18:42 +00:00
tools Remove autotools build system 2016-01-28 12:00:33 +00:00
utils Revise polly-{update|check}-format targets 2015-09-14 16:59:50 +00:00
www www: Remove some spaces 2016-02-04 06:41:03 +00:00
.arcconfig Adjusted arc linter config for modern version of arcanist 2015-08-12 09:01:16 +00:00
.arclint Adjusted arc linter config for modern version of arcanist 2015-08-12 09:01:16 +00:00
.gitattributes gitattributes: .png and .txt are no text files 2013-07-28 09:05:20 +00:00
.gitignore Add git patch files to .gitignore 2015-06-23 20:55:01 +00:00
CMakeLists.txt Add basic doxygen infrastructure for Polly 2016-02-04 07:16:36 +00:00
CREDITS.txt Add myself to the credits 2014-08-10 03:37:29 +00:00
LICENSE.txt Update the copyright credits -- Happy new year 2014! 2014-01-01 08:27:31 +00:00
README Trivial change to the README, mainly to test commit access. 2012-10-09 04:59:42 +00:00

README

Polly - Polyhedral optimizations for LLVM
-----------------------------------------
http://polly.llvm.org/

Polly uses a mathematical representation, the polyhedral model, to represent and
transform loops and other control flow structures. Using an abstract
representation it is possible to reason about transformations in a more general
way and to use highly optimized linear programming libraries to figure out the
optimal loop structure. These transformations can be used to do constant
propagation through arrays, remove dead loop iterations, optimize loops for
cache locality, optimize arrays, apply advanced automatic parallelization, drive
vectorization, or they can be used to do software pipelining.