Commit Graph

295 Commits

Author SHA1 Message Date
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 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 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 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 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
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 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
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
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
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 b7e4083599 Updated to isl 2c19ecd444095d6f560349018f68993bc0e03691
Changed test cases and fixed warnings.

llvm-svn: 218043
2014-09-18 11:13:35 +00:00
Johannes Doerfert 0fe35dd088 [Fix] Rewire the Region after a unconditional entry edge is created
We use SplitEdge to split a conditional entry edge of the SCoP region.
  However, SplitEdge can cause two different situations (depending on
  whether or not the edge is critical). This patch tests
  which one is present and deals with the former unhandled one.

  It also refactors and unifies the case we have to change the basic
  blocks of the SCoP to new ones (see replaceScopAndRegionEntry).

llvm-svn: 217802
2014-09-15 18:34:45 +00:00
Johannes Doerfert 377a620f98 Compute and print the minimal loop carried dependency distance
During the IslAst parallelism check also compute the minimal dependency
  distance and store it in the IstAst for node.

Reviewer: sebpop

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

llvm-svn: 217729
2014-09-13 17:34:11 +00:00
Tobias Grosser 230acc4445 Delinearize _all_ accesses to a multi-dimensional array
Even though we previously correctly detected the multi-dimensional access
pattern for accesses with a certain base address, we only delinearized
non-affine accesses to this address. Affine accesses have not been touched and
remained as single dimensional accesses. The result was an inconsistent
description of accesses to the same array, with some being one dimensional and
some being multi-dimensional.

This patch ensures that all accesses are delinearized with the same
dimensionality as soon as a single one of them has been detected as non-affine.

While writing this patch, it became evident that the options
-polly-allow-nonaffine and -polly-detect-keep-going have not been properly
supported in case delinearization has been turned on. This patch adds relevant
test coverage and addresses these issues as well. We also added some more
documentation to the functions that are modified in this patch.

This fixes llvm.org/PR20123

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

llvm-svn: 217728
2014-09-13 14:47:55 +00:00
Tobias Grosser bcd4efffa7 Check that the elements of an array have the same size
At the moment we assume that only elements of identical size are stored/loaded
to a certain base pointer. This patch adds logic to the scop detection to verify
this.

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

llvm-svn: 217727
2014-09-13 14:47:40 +00:00
Tobias Grosser 3762bd34e7 Improve test coverage for non-affine access functions
We now verify that such functions are correctly detected even in combination
with delinearization. This change is added to ensure we have good test coverage
for the subsequent delinearization fix.

We also remove unnecessary instructions from the test case.

llvm-svn: 217664
2014-09-12 09:07:56 +00:00
Tobias Grosser 0ef617dda0 Remove executable bit on test files
Some test files had been marked executable by accident.

llvm-svn: 217663
2014-09-12 09:07:50 +00:00
Johannes Doerfert dd5c144246 Allow to generate a loop without the GuardBB
This allows us to omit the GuardBB in front of created loops
  if we can show the loop trip count is at least one. It also
  simplifies the dominance relation inside the new created region.
  A GuardBB (even with a constant branch condition) might trigger
  false dominance errors during function verification.

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

llvm-svn: 217525
2014-09-10 17:33:32 +00:00
Johannes Doerfert 3826224428 [Refactor] Cleanup isl code generation
Summary:
  + Refactor the runtime check (RTC) build function
  + Added helper function to create an PollyIRBuilder
  + Change the simplify region function to create not
    only unique entry and exit edges but also enfore that
    the entry edge is unconditional
  + Cleaned the IslCodeGeneration runOnScop function:
      - less post-creation changes of the created IR
  + Adjusted and added test cases

Reviewers: grosser, sebpop, simbuerg, dpeixott

Subscribers: llvm-commits, #polly

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

llvm-svn: 217508
2014-09-10 14:50:23 +00:00
David Peixotto 9690f3b596 Add -e to test generation script
The -e flag exits the script with a non-zero code if any subcommand
fails. This flag allows us to notice as early as possible if the
test was not properly regenerated using a command like:

$ create_ll.sh t.c && opt < t.ll -polly ...

The above pattern is useful when iteratively developing a test case
to guard against un-noticed syntax errors.

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

llvm-svn: 217463
2014-09-09 22:14:38 +00:00
Johannes Doerfert 8e95dc657e [Fix] OpenMP parallel loop detection for the isl backend
There was a bug in the IslAst which caused that no more outermost
  parallel loops were detected/checked after a parallel outermost loop
  of depth 1.

  + Test case attached

llvm-svn: 217452
2014-09-09 17:03:54 +00:00
Tobias Grosser e7e33ba13a Always pipe in test files
In Polly we used to have a mix of test cases, some that used 'opt %s' and others
that used 'opt < %s'. We now change all to use 'opt < %s'. Piping in test files
is preferable as it does prevent temporary files to be written to disk. This
brings us in line with what is usus in LLVM.

llvm-svn: 216816
2014-08-30 09:15:04 +00:00
Tobias Grosser 2faa569c0a Replace %defaultOpts with explicit pass names
This replaces the use of %defaultOpts = '-basicaa -polly-prepare' with the
minimal set of passes necessary for a test to succeed. Of the test cases that
previously used %defaultOpts 76 test cases require none of these passes, 42
need -basicaa and only 2 need -polly-prepare. Our change makes this requirement
explicit.

In Polly many test cases have been using a macro '%defaultOpts' which run a
couple of preparing passes before the actual Polly test case. This macro was
introduced very early in the development of Polly and originally contained a
large set of canonicalization passes.  However, as the need for additional
canonicalization passes makes test cases harder to understand and also more
fragile in terms of changes in such passes, we aim since a longer time to only
include the minimal set of passes necessary. This patch removes the last
leftovers from of %defaultOpts and brings our tests cases more in line to what
is usus in LLVM itself.

llvm-svn: 216815
2014-08-30 09:13:28 +00:00
Johannes Doerfert 9e7b17b0d4 Added arcanist linters and cleaned errors and warnings
Arcanist (arc) will now always run linters before uploading any new
  commit to Phabricator. All errors/warnings (or their absence) will be
  shown in the web interface together with a explanation by the commiter
  (arcanist will ask the commiter if the build was not clean).

  The linters include:
    - clang-format
    - spelling check
    - permissions check (aka. chmod)
    - filename check
    - merge conflict marker check
  Note, that their scope is sometimes limited (see .arclint for
  details).

  This commit also fixes all errors and warnings these linters reported,
  namely:
    - spelling mistakes and typos
    - executable permissions for various text files

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

llvm-svn: 215871
2014-08-18 00:40:13 +00:00
Andreas Simbuerger 6bf77979e0 Diagnostic: Provide end-user message for non-affine loop bound errors
llvm-svn: 215832
2014-08-17 10:09:15 +00:00
Andreas Simbuerger d46b935267 Diagnostic: Provide end-user message for non-affine access function errors
llvm-svn: 215831
2014-08-17 10:09:11 +00:00
Andreas Simbuerger f29f625748 Diagnostic: Provide end-user message for aliasing errors
This will spill out information about LLVM-internals. However, in cases
where the name of the Value matches the name of the array in the source,
we provide more useful information. In cases where we spill internals,
the information still might help the user to pin down the correct
arrays.
The problem we face here is: The error is pinned to the debug location
of one of the offending values out of the alias set instead of all of them.

The more information we give the user about the set of aliasing
pointers the better.

llvm-svn: 215830
2014-08-17 10:09:07 +00:00
Tobias Grosser 2873594709 Revert "[Refactor] Cleanup runtime code generation"
This reverts commit 215466 (and 215528, a trivial formatting fix).

The intention of these commits is a good one, but unfortunately they broke
our LNT buildbot:

http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3-polly-codegen-isl

Several of the cleanup changes that have been combined in this 'fixup' are
trivial and could probably be committed as obvious changes without risking to
break the build. The remaining changes are little and it should be easy to
figure out what went wrong.

llvm-svn: 215817
2014-08-16 09:09:15 +00:00
Tobias Grosser f4daf34496 Revert "Added support for modulo expressions"
This reverts commit 215684. The intention of the commit is great, but
unfortunately it seems to be the cause of 14 LNT test suite failures:

http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3-polly/builds/116

To make our buildbots and performance testers green until this issue is solved,
we temporarily revert this commit.

llvm-svn: 215816
2014-08-16 09:08:55 +00:00
Johannes Doerfert 5130c849aa Added support for modulo expressions
The support is limited to signed modulo access and condition
  expressions with a constant right hand side, e.g., A[i % 2] or
  A[i % 9]. Test cases are modified according to this new feature and
  new test cases are added.

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

llvm-svn: 215684
2014-08-15 01:14:11 +00:00
Johannes Doerfert 9744c4af16 [Refactor] Cleanup runtime code generation
+ Use regexp in two test case.
  + Refactor the runtime condition build function

llvm-svn: 215466
2014-08-12 18:35:54 +00:00
Johannes Doerfert fab63f7791 [Minor] Change the number of cut lines for new tests
This should cut all metadata community clang produces.

llvm-svn: 215422
2014-08-12 03:31:23 +00:00
Tobias Grosser f57d63f906 Do allow negative offsets in the outermost array dimension
There is no needed for neither 1-dimensional nor higher dimensional arrays to
require positive offsets in the outermost array dimension.

We originally introduced this assumption with the support for delinearizing
multi-dimensional arrays.

llvm-svn: 214665
2014-08-03 21:07:30 +00:00
Johannes Doerfert a63b2579c6 Fix the modifiable access creation
+ Remove the class IslGenerator which duplicates the functionality of
    IslExprBuilder.
  + Use the IslExprBuilder to create code for memory access relations.
    + Also handle array types during access creation.
  + Enable scev codegen for one of the transformed memory access tests,
    thus access creation without canonical induction variables available.
  + Update one test case to the new output.

llvm-svn: 214659
2014-08-03 01:51:59 +00:00