Commit Graph

1287 Commits

Author SHA1 Message Date
Tobias Grosser 7b00d8f979 Do not run dead code elimination by default
The dead code elimination is a pass that looks very promising, but needs some
more compile-time tuning before enabling it by default seems sensible.

llvm-svn: 223965
2014-12-10 21:12:23 +00:00
Tobias Grosser bd8f3c1f61 Unbreak after LLVM's metadata split in r223802
llvm-svn: 223838
2014-12-09 22:02:16 +00:00
Tobias Grosser 05fdab9362 Simplify computation of reduction dependences
This simplifies the construction of the input for the reduction dependence
computation and at the same time removes an assumption that expects the schedule
to be of 2D + 1 form (the odd dimensions giving textual order, the even
dimensions the loop iterations).

llvm-svn: 223621
2014-12-07 22:51:45 +00:00
Duncan P. N. Exon Smith 16173b7f6c Stop relying on MDNode::get() returning self-references
Update for LLVM API change, wherein self-references are not uniqued (and
will never be returned by `MDNode::get()`).  We already have `Id`; just
return it.

This should fix the failing buildbot:

  http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25167
  http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25168

llvm-svn: 223620
2014-12-07 21:12:10 +00:00
Tobias Grosser e80523350f Drop unused 'docs' directory
llvm-svn: 223608
2014-12-07 16:04:33 +00:00
Tobias Grosser 13e222ca55 Update to the latest version of isl
Isl now specifically marks modulo operations that are compared against zero.
They can be implemented with the C/LLVM remainder operation.

We also update a couple of test cases where the output of isl has slightly
changed.

llvm-svn: 223607
2014-12-07 16:04:29 +00:00
Tobias Grosser 7ceaba8600 www-todo: No need to directly integrate with the basic block vectorizer
llvm-svn: 223606
2014-12-07 15:57:29 +00:00
Tobias Grosser a7e07abbff www-todo: We assume accesses to fixed-size arrays are in-bounds
llvm-svn: 223605
2014-12-07 15:56:21 +00:00
Tobias Grosser 4a69bea6c2 checkout_isl: Do not fail in presence of an old CLooG checkout
This should help our buildbots and may also simplify life for other people.

llvm-svn: 223152
2014-12-02 21:04:20 +00:00
Tobias Grosser e9458655fe Make checkout isl script executable
llvm-svn: 223146
2014-12-02 19:49:40 +00:00
Johannes Doerfert 305fed96e6 Drop Cloog support
This commit drops the Cloog support for Polly. The scripts and
  documentation are changed to only use isl as prerequisity. In the code
  all Cloog specific parts have been removed and all relevant tests have
  been ported to the isl backend when it was created.

llvm-svn: 223141
2014-12-02 19:26:58 +00:00
Tobias Grosser 7432a64dcb Drop unused enum value
llvm-svn: 222980
2014-11-30 15:57:07 +00:00
Tobias Grosser 71badac9d6 Remove Polly's IndVarSimplify pass
Polly had a copy of this pass to create the canonical induction variables
necessary for the non-scev-based code generation. As we now always use SCEV
based code generation, canonical induction variables are not needed any more.

llvm-svn: 222979
2014-11-30 14:33:41 +00:00
Tobias Grosser 683b8e4462 Remove -polly-codegen-scev option and related code
SCEV based code generation has been the default for two weeks after having
been tested for a long time. We now drop the support the non-scev-based code
generation.

llvm-svn: 222978
2014-11-30 14:33:31 +00:00
Tobias Grosser 65b2b03fa4 cmake: Add polly libraries to LLVMExports
This fixes LINK_POLLY_INTO_TOOLS=ON builds, which previously failed with:

CMake Error: install(EXPORT "LLVMExports" ...) includes target "opt" which
requires target "Polly" that is not in the export set.

CMake Error: install(EXPORT "LLVMExports" ...) includes target "bugpoint" which
requires target "Polly" that is not in the export set.

llvm-svn: 222977
2014-11-30 12:45:44 +00:00
Hongbin Zheng c5447f4c3b Do not incorrectly set the inverted flag.
In TempScopInfo::buildCondition we extract the conditions to guard the
BB *in addition of* loop bounds. This means we should only consider the
conditions in the paths (in CFG) that do not contain cycles (loops).

At the same time, we set the invert flag if the FalseBB of the current
branch dominates our target BB to indicate that we reach the target BB
with an inverted condition from the current branch.

In this case, the path from the FalseBB contains a cycle if the FalseBB
is the target of a backedge. The conditions implied by such a path should
not be consider. We can identify such a case by checking if the TrueBB
also dominates our target BB, which means we can also reach our target
BB from the TrueBB, without going through the backedge.

llvm-svn: 222907
2014-11-28 03:26:06 +00:00
Tobias Grosser 68c497fb22 autoconf: Move libraries later to ensure that all symbols are found
This fixes llvm.org/PR19540

llvm-svn: 222874
2014-11-27 10:14:27 +00:00
Tobias Grosser 154d9469f4 Add PreHeader always to OuterLoop
This fixes a bug introduce in r217525.

llvm-svn: 222766
2014-11-25 17:09:21 +00:00
Tobias Grosser 7b50beebe4 Assume GetElementPtr offsets to be inbounds
In case a GEP instruction references into a fixed size array e.g., an access
A[i][j] into an array A[100x100], LLVM-IR does not guarantee that the subscripts
always compute values that are within array bounds. We now derive the set of
parameter values for which all accesses are within bounds and add the assumption
that the scop is only every executed with this set of parameter values.

Example:

void foo(float A[][20], long n, long m {
    for (long i = 0; i < n; i++)
      for (long j = 0; j < m; j++)
        A[i][j] = ...

This loop yields out-of-bound accesses if m is at least 20 and at the same time
at least one iteration of the outer loop is executed. Hence, we assume:

  n <= 0 or m <= 20.

Doing so simplifies the dependence analysis problem, allows us to perform
more optimizations and generate better code.

TODO: The location where the GEP instruction is executed is not necessarily the
location where the memory is actually accessed. As a result scanning for GEP[s]
is imprecise. Even though this is not a correctness problem, this imprecision
may result in missed optimizations or non-optimal run-time checks.

In polybench where this mismatch between parametric loop bounds and fixed size
arrays is common, we see with this patch significant reductions in compile time
(up to 50%) and execution time (up to 70%). We see two significant compile time
regressions (fdtd-2d, jacobi-2d-imper), and one execution time regression
(trmm).  Both regressions arise due to additional optimizations that have been
enabled by this patch. They can be addressed in subsequent commits.

http://reviews.llvm.org/D6369

llvm-svn: 222754
2014-11-25 10:51:12 +00:00
Tobias Grosser 6a629c59ba Use isl_schedule_get_ctx
llvm-svn: 222560
2014-11-21 19:39:42 +00:00
Tobias Grosser 983997ff6a Fix typo
llvm-svn: 222559
2014-11-21 19:39:38 +00:00
Tobias Grosser b7e06becd9 todo: We can support modifiable memory access functions
llvm-svn: 222366
2014-11-19 16:31:33 +00:00
Tobias Grosser 5c9e79d025 todo: We now have OpenMP support in isl backend
llvm-svn: 222365
2014-11-19 16:30:16 +00:00
Johannes Doerfert cc652b88e8 Change states in the www/todo.html list
llvm-svn: 222362
2014-11-19 15:59:50 +00:00
Johannes Doerfert 9c14737b9b Simplify the SCEVAffinator [NFC]
llvm-svn: 222360
2014-11-19 15:36:59 +00:00
Tobias Grosser 422b30a017 Use new Small(Ptr)Set API
This fixes the recent build failures.

llvm-svn: 222358
2014-11-19 14:32:32 +00:00
Tobias Grosser 7031141009 Enable SCEV based code generation by default
SCEV based code generation allows Polly to detect and generate code for loops
that do not have an explicit induction variable, but only virtual induction
variables given by SCEV.

Being able to do so has two main benefits:

  - We can detect more scops by default
  - We require less canonicalization before Polly, which means we get closer
    to our goal of not touching the IR before analyzing its properties.
    Specifically, we do not need to run -polly-indvars to introduce explicit
    canonical induction variables.

This switch became possible as both the isl code generation and -polly-parallel
are LNT error free with SCEV based code generation and the isl ast generator.

llvm-svn: 222113
2014-11-16 22:50:23 +00:00
Tobias Grosser bab3568105 Modify test cases to work with SCEV based code generation
This patch includes tests where we actually need to adjust the CHECK lines
for SCEV based code generation. Besides these adjustments we add explicit
calls to -polly-codegen-scev=[true|false] and make sure we test both cases.

llvm-svn: 222112
2014-11-16 22:43:21 +00:00
Tobias Grosser 95cd1c718e Make usage of scev based code generation explicit in tests
This is in preparation of using SCEV based codegen by default in polly

llvm-svn: 222111
2014-11-16 21:43:28 +00:00
Tobias Grosser a4377d3eb8 Fix formatting
llvm-svn: 222106
2014-11-16 21:03:32 +00:00
Tobias Grosser 2f8732e7c6 Independent blocks: SE->forget() scalars translated to arrays
This prevents SCEVs to reference values not valid any more and as a consequence
solves a bug where such values reintroduced during ast generation caused the
independent blocks pass to fail validation.

http://llvm.org/PR21204

llvm-svn: 222103
2014-11-16 20:33:58 +00:00
Tobias Grosser 4f124821e4 Remove an unnecessary ifdef
Reported-by: Johannes Doerfert <doerfert@cs.uni-saarland.de>
llvm-svn: 222102
2014-11-16 17:16:30 +00:00
Tobias Grosser b05b038b81 Switch default code generation backend to isl
The isl based backend has been tested since a long time and with the recently
commited OpenMP support the last missing piece of functionality was ported from
the CLooG backend.

The isl based backend gives us interesting new functionality:

  - Run-time alias checks (enabled by default)

  Optimize scops that contain possibly aliasing pointers. This feature has
  largely increased the number of loop nests we consider for optimization.

  Thanks Johannes!

  - Delinearization (not yet enabled by default)

  Model accesses to multi-dimensional arrays precisely. This will allow us to
  understand kernels with multi-dimensional VLAs written in Julia, boost::ublas,
  coremark or C99.

  Thanks Sebastian!

  - Generation of higher quality code

  Sven and me spent a long time to optimize the quality of the generated code. A
  major focus were expressions as they result from modulos/divisions or
  piecewise affine expressions (a ? b : c).

  - Full/Partial tile separation, polyhedral unrolling

  The isl code generation provides functionality to generate specialized code
  for core and cleanup loops and to specialize code using polyhedral context
  information while unrolling statements.

  (not yet exploited in Polly)

  - Modifieable access functions

  We can now use standard isl functionality to remap memory accesses to new
  data locations. A standard use case is the use of shared memory, where
  accesses to a larger region in global memory need to be mapped to a smaller
  shared memory region using a modulo mapping.

  (not yet exploited in Polly)

The cloog based code generation is still available for comparision, but is
scheduled for removal.

llvm-svn: 222101
2014-11-16 17:02:11 +00:00
Tobias Grosser bf34f1d2b2 Introduce minimalistic cost model for auto parallelization
Instead of parallelizing every parallel outermost loop, we now use a very
minimalistic cost model. Specifically, we assume innermost loops are not
worth parallelising and all non-innermost loops are.

When parallelizing all loops in LNT we got several slowdowns/timeouts due to
us parallelizing innermost loops that are executed only a couple of times
(number of iterations not known statically). With this basic heuristic enabled
LNT does not show any more timeouts, while several interesting loops are still
parallelized.

There are many ways to obtain an improved heuristic. Constructing such an
improvide heuristic from a position of minimal slow-down and zero code size
increase seems to be the best, as it allows us to track progress on LNT.

llvm-svn: 222096
2014-11-16 14:24:53 +00:00
Tobias Grosser d1c12e65cd Remove one incomplete test case accidentally committed
llvm-svn: 222089
2014-11-15 21:34:34 +00:00
Tobias Grosser e3c0558e35 Add OpenMP code generation to isl backend
This backend supports besides the classical code generation the upcoming SCEV
based code generation (which the existing CLooG backend does not support
robustly).

OpenMP code generation in the isl backend benefits from our run-time alias
checks such that the set of loops that can possibly be parallelized is a lot
larger.

The code was tested on LNT. We do not regress on builds without -polly-parallel.
When using -polly-parallel most tests work flawlessly, but a few issues still
remain and will be addressed in follow up commits.

SCEV/non-SCEV codegen:
  - Compile time failure in ldecod and TimberWolfMC due a problem in our
    run-time alias check generation triggered by pointers that escape through
    the OpenMP subfunction (OpenMP specific).

  - Several execution time failures. Due to the larger set of loops that we now
    parallelize (compared to the classical code generation),  we currently run
    into some timeouts in tests with a lot loops that have a low trip count and
    are slowed down by parallelizing them.

SCEV only:

  - One existing failure in lencod due to llvm.org/PR21204 (not OpenMP specific)

OpenMP code generation is the last feature that was only available in the CLooG
backend. With the isl backend being the only one supporting features such as
run-time alias checks and delinearization, we will soon switch to use the isl
ast generator by the default and subsequently remove our dependency on CLooG.

http://reviews.llvm.org/D5517

llvm-svn: 222088
2014-11-15 21:32:53 +00:00
Tobias Grosser c98a8fccf7 Use nullptr instead of '0' for pointers
llvm-svn: 221982
2014-11-14 11:12:31 +00:00
David Peixotto a4817871d2 Safely generate new loop metadata node
Polly was accidently modifying a debug info metadata node when
attempting to generate a new unique metadata node for the loop id.
The problem was that we had dwarf metadata that referred to a
metadata node with a null value, like this:

  !6 = ... some dwarf metadata referring to !7 ...
  !7 = {null}

When we attempt to generate a new metadata node, we reserve the
first space for self-referential node by setting the first argument
to null and then mutating the node later to refer to itself.
However, because the nodes are uniqued based on pointer values, when
we get the new metadata node it actually referred to an existing
node (!7 in the example).  When we went to modify the metadata to
point to itself, we were accidently mutating the dwarf metatdata. We
ended up in this situation:

  !6 = ... some dwarf metadata referring to !7 ...
  !7 = {!7}

and this causes an assert when generating the debug info. The fix is
simple, we just need to use a unique value when getting a new
metadata node. The MDNode::getTemporary() provides exactly the API
we need (and it is used in clang to generate the unique nodes).

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

llvm-svn: 221550
2014-11-07 21:44:18 +00:00
Johannes Doerfert 80ef110cca [Refactor][NFC] Generalize the creation of ScopArrayInfo objects.
Differential Revision: http://reviews.llvm.org/D6031

llvm-svn: 221512
2014-11-07 08:31:31 +00:00
Tobias Grosser 81641db93e Fix formatting
llvm-svn: 221483
2014-11-06 21:25:54 +00:00
Tobias Grosser 8b5344fda2 Explicitly annotate loops we want to run thread-parallel
We introduces a new flag -polly-parallel and use it to annotate the for-nodes in
the isl ast that we want to execute thread parallel (e.g., using OpenMP). We
previously already emmitted openmp annotations, but we did this for various
kinds of parallel loops, including some which we can not run in parallel.

With this patch we now have three annotations:

  1) #pragma known-parallel [reduction]
  2) #pragma omp for
  3) #pragma simd

meaning:

  1) loop has no loop carried dependences
  2) loop will be executed thread-parallel
  3) loop can possibly be vectorized

This patch introduces 1) and reduces the use of 2) to only the cases where we
will actually generate thread parallel code.

It is in preparation of openmp code generation in our isl backend.

Legacy:

- We also have a command line option -enable-polly-openmp. This option controls
  the OpenMP code generation in CLooG. It will become an alias of
  -polly-parallel after the CLooG code generation has been dropped.

http://reviews.llvm.org/D6142

llvm-svn: 221479
2014-11-06 19:35:21 +00:00
Tobias Grosser ec7d67ede0 Extract SCEV generation into subfunction
This makes the code more readable and will be reused in subsequent OpenMP
patches.

llvm-svn: 221418
2014-11-06 00:27:01 +00:00
Tobias Grosser 16371acdc4 BlockGenerator: Recompute values from SCEV before handing back the original values
This patch moves the SCEV based (re)generation of values before the checking for
scop-constant terms. It enables us to provide SCEV based replacements, which
are necessary to correctly generate OpenMP subfunctions when using the SCEV
based code generation.

When recomputing a new value for a value used in the code of the original scop,
we previously directly returned the same original value for all scop-constant
expressions without even trying to regenerate these values using our SCEV
expression. This is correct when the newly generated code remains fully in the
same function, however in case we want to outline parts of the newly generated
scop into subfunctions, this approach means we do not have any opportunity to
update these values in the SCEV based code generation. (In the non-SCEV based
code generation, we can provide such updates through the GlobalMap). To ensure
we have this opportunity, we first try to regenerate scalar terms with our SCEV
builder and will only return scop-constant expressions if SCEV based code
generation was not possible.

This change should not affect the results of the existing code generation
passes. It only impacts the upcoming OpenMP based code generation.

This commit also adds a test case. This test case passes before and after this
commit. It was added to ensure test coverage for the changed code.

llvm-svn: 221393
2014-11-05 20:48:56 +00:00
Tobias Grosser d213a8b810 BlockGenerator: inline lookupAvailableValue into getValue [NFC]
There was no good reason why this code was split accross two functions.

In subsequent changes we will change the order in which values are looked up.
Doing so would make the split into two functions even more arbitrary.

We also slightly improve the documentation.

llvm-svn: 221388
2014-11-05 19:46:04 +00:00
Tobias Grosser 477a1dce2b Use argument type directly from fflush if available in translation unit
When our RuntimeDebugBuilder calles fflush(NULL) to flush all output streams, it
is important that the types we use in the call match the ones used in a
declaration of fflush possible already available in the translation unit.

As we just pass on a NULL pointer, the type of the pointer value does not really
matter. However, as LLVM complains in case of mismatched types, we make sure
to create a NULL pointer of identical type.

No test case, as RuntimeDebugBuilder is not permanently used in Polly. Calls to
it are until now only used to add informative output during debugging sessions.

llvm-svn: 221251
2014-11-04 09:18:24 +00:00
Tobias Grosser 7f14dd53e9 Revert "Temporary disable formatting error"
This reverts commit r221159, as clang-format is again back to its old behaviour
and we do not cause any buildbot error messages any more.

llvm-svn: 221189
2014-11-03 22:11:20 +00:00
Tobias Grosser c98e413498 Temporary disable formatting error
This should silence the buildbots until we understand if the clang-format
changes in r221125 have been intentional. See reply on cfe-commits for details.

llvm-svn: 221159
2014-11-03 15:42:45 +00:00
Johannes Doerfert 21aa3dc014 [FIX] Move the statistic code to fix the build.
llvm-svn: 221038
2014-11-01 01:30:11 +00:00
Johannes Doerfert 5ad8a6a588 Remove the LoopBounds from the TempScop class.
We will use ScalarEvolution in the ScopInfo.cpp to get the loop trip
  count, not cache it in the TempScop object.

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

llvm-svn: 221035
2014-11-01 01:14:56 +00:00
Johannes Doerfert e3da05ac32 Remove the MaxLoopDepth attribute from the TempScop class
Now MaxLoopDepth only lives in Scops not in TempScops anymore.
  This is the first part of a series of changes to make TempScops
  obsolete.

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

llvm-svn: 221026
2014-11-01 00:12:13 +00:00
Johannes Doerfert 75bd66e51d [Refactor][NFC] Remove unused argument.
llvm-svn: 221016
2014-10-31 23:16:02 +00:00
Johannes Doerfert 7c494217f3 [Refactor][NFC] Map basic blocks to SCoP statements.
This will simplify the construction of domains and the modeling of
  PHI's.

llvm-svn: 221015
2014-10-31 23:13:39 +00:00
Tobias Grosser ab23c9e724 Delete some unnecessary code
Originally we have needed this code to map the isl_id of an array to its base
pointer. However, as now the isl_id contains a reference to the array itself we
obtain the base pointer from this isl_id and we do not need to add this
information to the IDToValue map.

llvm-svn: 220876
2014-10-29 22:09:54 +00:00
Tobias Grosser a5605d34b9 Fix typo
llvm-svn: 220870
2014-10-29 19:58:28 +00:00
Daniel Jasper 8a1dea0ced Fix polly formatting after recent clang-format behavior change.
llvm-svn: 220711
2014-10-27 19:45:31 +00:00
Tobias Grosser 1d5c6c71d1 Fix typo
llvm-svn: 220446
2014-10-22 23:26:48 +00:00
Tobias Grosser 878aba4980 Remove incorrect value description for -enable-polly-aligned
The description of the parameter value passed to -enable-polly-aligned did
not make any sense at all, but was just a leftover coming from when this option
was copied form -enable-polly-openmp. We just drop it as the option description
gives sufficient information already.

llvm-svn: 220445
2014-10-22 23:22:41 +00:00
Tobias Grosser 01aea5809f Use stringFromIslObj instead of isl_..._dump to print to dbgs()
This makes sure we consistently use dbgs() when printing debug output.
Previously, the code just mixed calls to isl_*_dump() with printing to dbgs()
and was relying for both methods to interact in predictable ways (same output
stream, no unexpected reordering of outputs).

llvm-svn: 220443
2014-10-22 23:16:28 +00:00
Tobias Grosser f084edd0b4 Use braces in multi-statement DEBUG() code [NFC]
By adding braces into the DEBUG statement we can make clang-format format code
such as:

  DEBUG(stmt1(); stmt2())

as multi-line code:

  DEBUG({
    stmt1();
    stmt2();
  });

This makes control-flow in debug statements easier to read.

llvm-svn: 220441
2014-10-22 23:00:03 +00:00
David Peixotto 8da2b93d9f Change the RegionSet type to a SetVector
This patch changes the RegionSet type used in ScopDetection from a
std::set to a llvm::SetVector. The reason for the change is to
ensure deterministic output when printing the result of the
analysis. We had a windows buildbot failure for the modified test
because the output was coming in a different order.

Only one test case needed to be modified for this change. We could
use CHECK-DAG directives instead of CHECK in the analysis test cases
because the actual order of scops does not matter, but I think that
change should be done in a separate patch that modifies all the
appliciable tests. I simply modified the test to reflect the
expected deterministic output.

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

llvm-svn: 220423
2014-10-22 20:39:07 +00:00
Johannes Doerfert a05214fb5d [Refactor][NfC] ReportLevel should be used as a bool not an int
llvm-svn: 219864
2014-10-15 23:24:28 +00:00
Johannes Doerfert a99130f042 [Refactor][NfC] Simplify and clean the handling of (new) access relations
This patch does not change the semantic on it's own. However, the
  dependence analysis as well as dce will now use the newest available
  access relation for each memory access, thus if at some point the json
  importer or any other pass will run before those two and set a new
  access relation the behaviour will be different. In general it is
  unclear if the dependence analysis and dce should be run on the old or
  new access functions anyway. If we need to access the original access
  function from the outside later, we can expose the getter again.

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

llvm-svn: 219612
2014-10-13 12:58:03 +00:00
Johannes Doerfert 9b5786960d Relax the condition on the jsop accesses regarding the alignment.
We restricted the new access functions to be a subset of the old one
  because we want to keep the alignment, however if the alignment is
  "not special", thus the default for the type, we can allow any access.


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

llvm-svn: 219503
2014-10-10 15:14:29 +00:00
Johannes Doerfert 341a15a64b Use the new access function (if present) to compute the access stride.
Differential Revision: http://reviews.llvm.org/D5661

llvm-svn: 219499
2014-10-10 14:28:46 +00:00
Johannes Doerfert 1947f863ef [Refactor][NFC] Simplify (Vector)BlockGenerator
This removes an unnecessary cast and a unnecessary local variable.

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

llvm-svn: 219338
2014-10-08 20:18:32 +00:00
Johannes Doerfert 731685e6bc Allow the VectorBlockGenerator to use the IslExprBuilder.
This also enables the VectorBlockGenerator to build load store
  accesses according to the newAccessRelation of a MemoryAccess.

llvm-svn: 219321
2014-10-08 17:25:30 +00:00
Johannes Doerfert 4c7ce479ea [Refactor] Rename MemoryAccess::Type as it clashes with llvm::Type
llvm-svn: 219294
2014-10-08 10:11:33 +00:00
Johannes Doerfert 74f6869435 [Fix] Ignore forwarding alias sets in the alias set tracker.
llvm-svn: 219275
2014-10-08 02:23:48 +00:00
Johannes Doerfert 219b20e1a3 [Fix] Non i1 typed select condition for weird pw aff functions.
In case the pieceweise affine function used to create an isl_ast_expr
  had empty cases (e.g., with contradicting constraints on the
  parameters), it was possible that the condition of the isl_ast_expr
  select was not a comparison but a constant (thus of type i64).

  This patch does two thing:
   1) Handle the case the condition of a select is not a i1 type like C.
   2) Try to simplify the pieceweise affine functions for the min/max
      access when we generate runtime alias checks. That step can often
      remove empty or redundant cases as well as redundant constrains.

  This fixes bug: http://llvm.org/PR21167

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

llvm-svn: 219208
2014-10-07 14:37:59 +00:00
Johannes Doerfert 3cb6372762 [Refactor] Change the comment style to silence -Wcomment
-Wcomment complained about a "multi-line comment" caused by the
  ascii art used in ScopHelper to describe the CFG.

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

llvm-svn: 219207
2014-10-07 14:34:13 +00:00
Johannes Doerfert f1ee2622be [Fix] Dead statements should not confuse the RTC generation
This fixes http://llvm.org/bugs/show_bug.cgi?id=21166 .

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

llvm-svn: 219131
2014-10-06 17:43:00 +00:00
Benjamin Kramer ae81abfa38 Try to unbreak the polly build.
llvm-svn: 219080
2014-10-05 11:58:57 +00:00
Johannes Doerfert 2ef33e9f16 Allow multidimensional accesses in the IslExprBuilder.
This resolved the issues with delinearized accesses that might alias,
  thus delinearization doesn't deactivate runtime alias checks anymore.

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

llvm-svn: 219078
2014-10-05 11:33:59 +00:00
Johannes Doerfert 1a28a8938e Introduce the ScopArrayInfo class.
This class allows to store information about the arrays in the SCoP.
  For each base pointer in the SCoP one object is created storing the
  type and dimension sizes of the array. The objects can be obtained via
  the SCoP, a MemoryAccess or the isl_id associated with the output
  dimension of a MemoryAccess (the description of what is accessed).

  So far we use the information in the IslExprBuilder to create the
  right base type before indexing into the base array. This fixes the
  bug http://llvm.org/bugs/show_bug.cgi?id=21113 (both test cases are
  included). On top of that we can now build runtime alias checks for
  delinearized arrays as the dimension sizes are also part of the
  ScopArrayInfo objects.

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

llvm-svn: 219077
2014-10-05 11:32:18 +00:00
Duncan P. N. Exon Smith 52fd68980c DI: LLVM schema change: fold constants into string
Update debug info testcases for the LLVM metadata schema change in
r219010 to fold metadata constant operands into a single `MDString`.

Part of PR17891.

llvm-svn: 219019
2014-10-03 21:08:48 +00:00
Johannes Doerfert a441783544 [Fix] Accidently changed the type of a libgomp argument in r219003.
Only subsequent patches introduced tests for the signature in the
  generated IR, thus the tests were wrong too and are adjusted now.

llvm-svn: 219017
2014-10-03 20:40:24 +00:00
Johannes Doerfert 1356ac75d1 Put the parallel context alloca into the function entry block.
We use lifetime markers to limit the actual life range (similar to clang).

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

llvm-svn: 219005
2014-10-03 19:12:05 +00:00
Johannes Doerfert 990cd4c2e2 Add option to limit the maximal number of parallel threads.
Differential Revision: http://reviews.llvm.org/D5581

llvm-svn: 219004
2014-10-03 19:11:10 +00:00
Johannes Doerfert 12b355a2ce [Refactor] Generalize parallel code generation
+ Generalized function names and comments
    + Removed OpenMP (omp) from the names and comments
    + Use common names (non OpenMP specific) for runtime library call creation
      methodes
  + Commented the parallel code generator and all its member functions
  + Refactored some values and methodes

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

llvm-svn: 219003
2014-10-03 19:10:13 +00:00
Johannes Doerfert 87901453d9 Align copied load/store instructions as the original.
This also forbids the json importer to access other memory locations
  than the original instruction as we to reuse the alignment of the
  original load/store.

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

llvm-svn: 218883
2014-10-02 16:22:19 +00:00
Johannes Doerfert 51d1c74d78 [Refactor] Rename LoopAnnotator to ScopAnnotator
The LoopAnnotator doesn't annotate only loops any more, thus it is
  called ScopAnnotator from now on.

  This also removes unnecessary polly:: namespace tags.

llvm-svn: 218878
2014-10-02 15:32:17 +00:00
Johannes Doerfert ecdf263c07 Allow to annotate alias scopes in the new SCoP.
The command line flag -polly-annotate-alias-scopes controls whether or not
  Polly annotates alias scopes in the new SCoP (default ON). This can improve
  later optimizations as the new SCoP is basically an alias free environment for
  them.

llvm-svn: 218877
2014-10-02 15:31:24 +00:00
Johannes Doerfert c3285a1ded Change the output of arc unit
arc unit will now show the number of consecutive tests with the same
  result instead of printing a "." for each one. Due to the number of
  tests the "dots" didn't fit in one line any more. Furthermore the
  result list is shortened, only non passing tests or tests taking
  longer than a time threshold (50ms) will be reported (both to the user
  and to phabricator).

llvm-svn: 218826
2014-10-01 21:26:24 +00:00
Adrian Prantl e6579cd9a6 Update testcase to new intrinsic format
llvm-svn: 218806
2014-10-01 20:40:12 +00:00
Johannes Doerfert c7b719fc03 Annotate LLVM-IR for all parallel loops
This change allows to annotate all parallel loops with loop id metadata.
  Furthermore, it will annotate memory instructions with
  llvm.mem.parallel_loop_access metadata for all surrounding parallel loops.
  This is especially usefull if an external paralleliser is used.

  This also removes the PollyLoopInfo class and comments the
  LoopAnnotator.

  A test case for multiple parallel loops is attached.

llvm-svn: 218793
2014-10-01 20:10:44 +00:00
Johannes Doerfert eeab05a084 [RTC] Use the domain to split alias groups.
We use a parametric abstraction of the domain to split alias groups
  if accesses cannot be executed under the same parameter evaluation.

  The two test cases check that we can remove alias groups if the
  pointers which might alias are never accessed under the same parameter
  evaluation and that the minimal/maximal accesses are not global but
  with regards to the parameter evaluation.

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

llvm-svn: 218758
2014-10-01 12:42:37 +00:00
Johannes Doerfert 13771738d3 [RTC] Split alias groups according to read only base addresses
If there are multiple read only base addresses in an alias group
  we can split it into multiple alias groups each with only one
  read only access. This way we might reduce the number of
  comparisons significantly as it grows linear in the number of
  alias groups but exponential in their size.

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

llvm-svn: 218757
2014-10-01 12:40:46 +00:00
Johannes Doerfert 928229fda6 Disable runtime alias checks when we ignore aliasing.
This is just a optimization to save the compile time and execution time
  for runtime alias checks if the user guarantees no aliasing all together.

llvm-svn: 218613
2014-09-29 17:06:29 +00:00
Tobias Grosser f8a678d2fd Build domtree of new loops correctly
This fixes a bug introduced in r217525.

llvm-svn: 218581
2014-09-28 22:40:36 +00:00
Johannes Doerfert 9143d67aba [RTC] Bail if too many parameters are involved in a RTC access.
If too many parameters are involved in accesses used to create RTCs
  we might end up with enormous compile times and RTC expressions.
  The reason is that the lexmin/lexmax is dependent on all these
  parameters and isl might need to create a case for every "ordering"
  of them (e.g., p0 <= p1 <= p2, p1 <= p0 <= p2, ...).

  The exact number of parameters allowed in accesses is defined by the
  command line option -polly-rtc-max-parameters=XXX and set by default
  to 8.

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

llvm-svn: 218566
2014-09-27 11:02:39 +00:00
Tobias Grosser 1eedb67fa6 We do not support alias checks for base pointers defined inside the SCoP
The run-time alias check places code that involves the base pointer at the
beginning of the SCoP. This breaks if the base pointer is defined inside the
SCoP. Hence, we can only create a run-time alias check if we are sure the base
pointer is not an instruction defined inside the scop. If it is we refuse to
handle the SCoP.

This commit should unbreak most of our current LNT failures.

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

llvm-svn: 218412
2014-09-24 21:04:29 +00:00
Tobias Grosser b105a2c3e0 [www] Update formatting of news feed
llvm-svn: 218238
2014-09-22 07:37:12 +00:00
Tobias Grosser 5d9728159d [www] Unbreak the newsfeed from polyhedral.info
llvm-svn: 218237
2014-09-22 06:56:45 +00:00
Johannes Doerfert 77bd5ae3d9 [Fix] Allow pointer types as access elements and compare them correctly
This fixes two problems which are usualy caused together:
    1) The elements of an isl AST access expression could be pointers
       not only integers, floats and vectores thereof.
    2) The runtime alias checks need to compare pointers but if they
       are of a different type we need to cast them into a "max" type
       similar to the non pointer case.

llvm-svn: 218113
2014-09-19 08:49:02 +00:00
Tobias Grosser 3ee7cdab53 Report possible aliasing deterministically
This commit drops a call to std::sort, which sorted the base pointers that
possibly alias according to the address at which their corresponding llvm::Value
was allocated. There does not seem to be any good reason, why those pointers
should be (re)sorted and this only makes the output indeterministic.

llvm-svn: 218052
2014-09-18 14:45:43 +00:00
Johannes Doerfert b9fb5a2cc6 [RTC] Runtime Alias Checks for the ISL backend (missing tests)
Test files missing in r218046.

llvm-svn: 218047
2014-09-18 11:20:36 +00:00
Johannes Doerfert b164c795b7 [RTC] Runtime Alias Checks for the ISL backend
This change will build all alias groups (minimal/maximal accesses
  to possible aliasing base pointers) we have to check before
  we can assume an alias free environment. It will also use these
  to create Runtime Alias Checks (RTC) in the ISL code generation
  backend, thus allow us to optimize SCoPs despite possibly aliasing
  pointers when this backend is used.

  This feature will be enabled for the isl code generator, e.g.,
  --polly-code-generator=isl, but disabled for:
    - The cloog code generator (still the default).
    - The case delinearization is enabled.
    - The case non-affine accesses are allowed.

llvm-svn: 218046
2014-09-18 11:17:17 +00:00
Johannes Doerfert dcb5f1dcf6 Allow the IslExprBuilder to build address of expressions
llvm-svn: 218045
2014-09-18 11:14:30 +00:00
Johannes Doerfert 5e8de624b5 Allow the IslExprBuilder to compare pointers
llvm-svn: 218044
2014-09-18 11:14:07 +00:00
Johannes Doerfert b7e4083599 Updated to isl 2c19ecd444095d6f560349018f68993bc0e03691
Changed test cases and fixed warnings.

llvm-svn: 218043
2014-09-18 11:13:35 +00:00