Commit Graph

1646 Commits

Author SHA1 Message Date
Tobias Grosser 173ecab705 Remove target triples from test cases
I just learned that target triples prevent test cases to be run on other
architectures. Polly test cases are until now sufficiently target independent
to not require any target triples. Hence, we drop them.

llvm-svn: 235384
2015-04-21 14:28:02 +00:00
Tobias Grosser 654af8f62f Fix some formatting issues
llvm-svn: 235381
2015-04-21 11:42:01 +00:00
Tobias Grosser 5483931117 Rename 'scattering' to 'schedule'
In Polly we used both the term 'scattering' and the term 'schedule' to describe
the execution order of a statement without actually distinguishing between them.
We now uniformly use the term 'schedule' for the execution order.  This
corresponds to the terminology of isl.

History: CLooG introduced the term scattering as the generated code can be used
as a sequential execution order (schedule) or as a parallel dimension
enumerating different threads of execution (placement). In Polly and/or isl the
term placement was never used, but we uniformly refer to an execution order as a
schedule and only later introduce parallelism. When doing so we do not talk
about about specific placement dimensions.

llvm-svn: 235380
2015-04-21 11:37:25 +00:00
Tobias Grosser b69d16ab24 Pass an actual schedule to the isl_union_access [NFC]
This change is a step towards using a single isl_schedule object throughout
Polly. At the moment the schedule is just constructed from the flat
isl_union_map that defines the schedule. Later we will obtain it directly
from the scop and potentially obtain a schedule with a non-trivial internal
structure that will allow faster dependence analysis.

llvm-svn: 235378
2015-04-21 11:01:34 +00:00
Tobias Grosser 094999bb55 Drop unneccessary -basicaa passes in DependenceInfo test cases
llvm-svn: 235374
2015-04-21 09:17:52 +00:00
Tobias Grosser 93fdc12358 Move to isl's new dependence analysis interface [NFC]
isl_union_map_compute_flow() has been replaced by
isl_union_access_info_compute_flow(). This change does not intend to
change funcitonality, yet. However, it will allow us to pass in subsequent
changes schedule trees to the dependence analysis instead of flat schedules.
This should speed up dependence analysis for important cases significantly.

llvm-svn: 235373
2015-04-21 08:47:29 +00:00
Duncan P. N. Exon Smith f06f583f1f Fix polly build after LLVM r235327
llvm-svn: 235343
2015-04-20 20:28:43 +00:00
Tobias Grosser 553af2a34c Update isl to a6523fb42c35
A minor update mostly documenting the isl coding style as well as adding
functions to inspect isl_schedule_constraints objects.

llvm-svn: 235273
2015-04-19 09:06:02 +00:00
Tobias Grosser 6f8fd8e98f Dependences: Allow to disable dependences computeout
llvm-svn: 235271
2015-04-19 07:07:26 +00:00
Tobias Grosser 5a475e7936 Drop unused extern declaration
llvm-svn: 235256
2015-04-18 15:57:56 +00:00
Tobias Grosser 4b6aa6eb8e Clear InsnToMemAcc map in ScopDetection after each runOnFunction
Otherwise, instructions in different functions that share the same pointer (due
to earlier modifications), might get assigned incorrect memory access
information (belonging to instructions in previous functions), which can result
in arbitrary memory corruption and assertion failures.

This fixes llvm.org/PR23160 and possibly also llvm.org/PR23167.

Note: InsnToMemAcc is a global variable that should never have existed in the
first place. We will clean this up in a subsequent patch.

Reported-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Debugged-by: Johannes Doerfert <doerfert@cs.uni-saarland.de>
llvm-svn: 235254
2015-04-18 11:01:25 +00:00
Tobias Grosser adfd1b730c Fix typo
llvm-svn: 235252
2015-04-18 09:40:01 +00:00
David Blaikie 556ffb7806 [opaque pointer types] Explicit non-pointer type for call expressions
(migration for recent LLVM change to textual IR for calls)

llvm-svn: 235146
2015-04-16 23:24:52 +00:00
Johannes Doerfert f8206cf6d4 Allow loops in non-affine subregions -- SCoP Modeling
This will allow the ScopInfo to build the polyhedral representation for
  non-affine regions that contain loops. Such loops are basically not visible
  in the SCoP representation. Accesses that are variant in such loops are
  therefor represented as non-affine accesses.

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

llvm-svn: 234713
2015-04-12 22:58:40 +00:00
Johannes Doerfert c3e91b4d51 [FIX] Change old diagnostic output
llvm-svn: 234712
2015-04-12 22:53:33 +00:00
Johannes Doerfert f3e98f44e3 Allow loops in non-affine subregions -- SCoP Detection
This will allow the ScopDetection to detect non-affine regions that
  contain loops. All loops contained will be collected and are
  accessible to later passes in order to adjust the access functions.
  As the loops are non-affine and will not be part of the polyhedral
  representation later, all accesses that are variant in these loops
  have to be over approximated as non-affine accesses. They are
  therefore handled the same way as other non-affine accesses.
  Additionally, we do not count non-affine loops for the profitability
  heuristic, thus a region with only a non-affine loop will only be
  detected if the general detection of loop free regions is enabled.

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

llvm-svn: 234711
2015-04-12 22:52:20 +00:00
Tobias Grosser aa7f0f8d5c Drop ISL_INSTALL path
There is no need for an isl install path anymore. isl is now part of Polly.

llvm-svn: 234605
2015-04-10 15:41:14 +00:00
Tobias Grosser fd965b35e9 Do not recommend -polly-vectorizer=polly
Instead, we recommend -polly-vectorizer=stripmine, which pre-vectorizers outer
loops for the LoopVectorizer to take over.

llvm-svn: 234478
2015-04-09 12:10:36 +00:00
Duncan P. N. Exon Smith 7cf5fedbad Fix polly build after LLVM r234263
llvm-svn: 234266
2015-04-07 00:29:05 +00:00
Duncan P. N. Exon Smith 7431fb0257 Upgrade testcases after LLVM r234181
Until r234181 we were silently upgrading old `@llvm.dbg` intrinsics.
Fix testcases in polly that were relying on that.

llvm-svn: 234192
2015-04-06 18:25:51 +00:00
David Blaikie f0e3d50d52 [opaque pointer type] More GEP API migrations
llvm-svn: 234131
2015-04-05 22:51:12 +00:00
Tobias Grosser 02cf69a6ed Make -polly-no-tiling work again
llvm-svn: 234125
2015-04-05 21:52:21 +00:00
Tobias Grosser 51b7298fa8 Adjust documentation to old -enable-polly-openmp -> -polly-parallel rename
Reported-by: Tomofumi Yuki <tomofumi.yuki@gmail.com>
llvm-svn: 234124
2015-04-05 19:52:38 +00:00
Tobias Grosser eb18649ead Sign-extend in case of non-matching bitwidth
This change ensures that we sign-extend integer types in case non-matching
operands are encountered when generating a multi-dimensional access offset.

This fixes http://llvm.org/PR23124

Reported-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
llvm-svn: 234122
2015-04-05 17:36:42 +00:00
Tobias Grosser 2a586c387b Do not assume all multi-parameter products are affine
As soon as one operand of the product is invalid, the entire product is invalid.
This happens for example if one of the operands is not loop-invariant.

This fixes http://llvm.org/PR23125

Reported-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com
llvm-svn: 234119
2015-04-05 14:57:50 +00:00
Tobias Grosser f4c24b29e2 Make run-time alias check generation deterministic
llvm-svn: 234117
2015-04-05 13:11:54 +00:00
Tobias Grosser 7527e3f59c Do not use the POLLY vector code generator if only strip-mining is requested
This fixes http://llvm.org/PR23127

Reported-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
llvm-svn: 234113
2015-04-05 06:53:21 +00:00
Tobias Grosser fe4bb1c81b [tests] Use -polly-vectorizer=polly directly
instead of defining a lit variable %vector-opt.

llvm-svn: 234112
2015-04-05 06:53:11 +00:00
Tobias Grosser 4f6bceface Do not scale tile loops
We now generate tile loops as:

 for (int c1 = 0; c1 <= 47; c1 += 1)
   for (int c2 = 0; c2 <= 47; c2 += 1)
     for (int c3 = 0; c3 <= 31; c3 += 1)
       for (int c4 = 0; c4 <= 31; c4 += 4)
         #pragma simd
         for (int c5 = c4; c5 <= c4 + 3; c5 += 1)
           Stmt_for_body3(32 * c1 + c3, 32 * c2 + c5);

instead of

 for (int c1 = 0; c1 <= 1535; c1 += 32)
   for (int c2 = 0; c2 <= 1535; c2 += 32)
     for (int c3 = 0; c3 <= 31; c3 += 1)
       for (int c4 = 0; c4 <= 31; c4 += 4)
         #pragma simd
         for (int c5 = c4; c5 <= c4 + 3; c5 += 1)
           Stmt_for_body3(c1 + c3, c2 + c5);

Run-time performance-wise this makes little difference, but this gives a large
reduction in compile time (10-30% on 17 LNT benchmarks). Apparently the isl
AST generator is not yet very efficient in generating the latter.

llvm-svn: 233675
2015-03-31 07:52:36 +00:00
Duncan P. N. Exon Smith c7ba53f9a9 DebugInfo: Use the new DebugLoc API from r233573
This should fix the build [1] after r233599 removed the old API.

[1]: http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3-polly-parallel-fast/builds/5265

llvm-svn: 233605
2015-03-30 21:47:17 +00:00
Tobias Grosser d654eeb862 Drop some CLooG leftovers
llvm-svn: 233572
2015-03-30 17:56:50 +00:00
Tobias Grosser 18b03e606e Delete some leftovers from scoplib
llvm-svn: 233571
2015-03-30 17:55:40 +00:00
Tobias Grosser 378e003748 Drop libpluto support
We do not have buildbots or anything that tests this functionality, hence it
most likely bitrots. People interested to use this functionality can always
recover it from svn history.

llvm-svn: 233570
2015-03-30 17:54:01 +00:00
Tobias Grosser 29e36dc0c6 Update isl to 285e92aea
This is mostly a set of schedule tree enhancements which are not yet directly
useful to Polly.

llvm-svn: 233567
2015-03-30 17:28:57 +00:00
Tobias Grosser 619190d5a7 Delinearization of expressions that contain array size parameters
This allows us to delinerize code such as:

  A[][n]

  for (i
    for (j
      A[i][n-j-1] = ...

which would previously have been delinearize to an access A[i+1][-j-1].

To recover the correct access we apply the piecewise expression:

  { A[i][j] -> A[i-1][i+N]: i < 0; A[i][j] -> A[i][i]: i >= 0}

This approach generalizes to higher dimensions.

llvm-svn: 233566
2015-03-30 17:22:28 +00:00
Tobias Grosser 3cfe2e06fb Add option to only run scop detection
llvm-svn: 233556
2015-03-30 16:05:48 +00:00
Tobias Grosser 6e6c7e014a Add forgotten underscore
llvm-svn: 233534
2015-03-30 12:22:39 +00:00
Tobias Grosser 4f663aae09 Add some missing isl prefixes
llvm-svn: 233533
2015-03-30 11:52:59 +00:00
Tobias Grosser aa660a9957 Gist-simplify access relations in the context of domain constraints
This simplifies already one test case and is needed for upcoming improvements
to our delinearization.

llvm-svn: 233507
2015-03-30 00:07:50 +00:00
Tobias Grosser eefe941619 Avoid nullptr dereference in the ScopGraphPrinter
Reported-by: http://buildd-clang.debian.net/scan-build
llvm-svn: 233505
2015-03-29 22:00:54 +00:00
Johannes Doerfert be40996cfe Strip constant factors from SCoP parameters
This will strip the constant factor of a parameter befor we add it to
  the SCoP. As a result the access functions are simplified, e.g., for
  the attached test case.

llvm-svn: 233501
2015-03-29 20:45:09 +00:00
Tobias Grosser 715007216c Bail out if too many alias run-time-check comparisions would be needed
This fixes a crash observed in ffmpeg.

llvm-svn: 233480
2015-03-28 15:11:14 +00:00
Tobias Grosser 50d4e2ebf1 Use an early return on failure
llvm-svn: 233479
2015-03-28 14:50:32 +00:00
Tobias Grosser 6794238c70 Code generate parameters and run-time checks after branching new code region
When creating parameters the SCEVexpander may introduce new induction variables,
that possibly create scalar dependences in the original scop, before we code
generate the scop. The resulting scalar dependences may then inhibit correct
code generation of the scop. To prevent this, we first version the code without
a run-time check and only then introduce new parameters and the run-time
condition. The if-condition that guards the original scop from being modified by
the SCEVexpander.

This change causes some test case changes as the run-time conditions are now
introduced in the split basic block rather than in the entry basic block.

This fixes http://llvm.org/PR22069

Test case reduced by: Karthik Senthil

llvm-svn: 233477
2015-03-28 09:34:40 +00:00
Tobias Grosser 17778eb826 Drop redundant run line in check
llvm-svn: 233476
2015-03-28 09:34:34 +00:00
Tobias Grosser 97112eeeff Fix stupid memory leak
llvm-svn: 233326
2015-03-26 22:22:33 +00:00
Tobias Grosser 2873645c51 Drop -polly-vectorizer-unroll-only option
This options was earlier used for experiments with the vectorizer, but to my
knowledge is not really used anymore. If anybody needs this, we can always
reintroduce this feature.

llvm-svn: 232934
2015-03-23 07:00:36 +00:00
Tobias Grosser bbb4cec2e8 Use schedule trees to perform post-scheduling transformations
Replacing the old band_tree based code with code that is based on the new
schedule tree [1] interface makes applying complex schedule transformations a lot
more straightforward. We now do not need to reason about the meaning of flat
schedules, but can use a more straightforward tree structure. We do not yet
exploit this a lot in the current code, but hopefully we will be able to do so
soon.

This change also allows us to drop some code, as isl now provides some higher
level interfaces to apply loop transformations such as tiling.

This change causes some small test case changes as isl uses a slightly different
way to perform loop tiling, but no significant functional changes are intended.

[1] http://impact.gforge.inria.fr/impact2014/papers/impact2014-verdoolaege.pdf

llvm-svn: 232911
2015-03-22 12:06:39 +00:00
Tobias Grosser 442c6ccb8c Add some missing __isl_give/__isl_keep annotations
llvm-svn: 232711
2015-03-19 07:43:35 +00:00
Tobias Grosser 9715b7c592 Add forgotten 'FileCheck' to tiling test cases
These test cases did not verify the CHECK lines at all. We add the FileCheck
and also fix some broken CHECK lines. Being here, we extend the checks to
cover the whole loop structure.

llvm-svn: 232710
2015-03-19 07:39:34 +00:00
Tobias Grosser 1de4e381ca Update isl to 94d707d
The major improvements are:

  - Extended schedule tree support
  - AST generation from schedule trees

llvm-svn: 232709
2015-03-19 07:27:29 +00:00
Duncan P. N. Exon Smith 0353f279f1 Fix debug info now that the verifier is on
`i32 0` isn't a valid type, and `!{i32 0}` isn't an empty array.

Needed because of r232505.

llvm-svn: 232514
2015-03-17 18:23:38 +00:00
David Blaikie 4a54fae8cb Test case updates for explicit type parameter to the gep operator
llvm-svn: 232186
2015-03-13 18:21:20 +00:00
Tobias Grosser f2716ea7d5 Add -polly-vectorizer=stripmine
By strip-mining outer loops to the innermost level we can enable LLVM's loop
vectorizer to vectorize outer loops.

llvm-svn: 232100
2015-03-12 20:48:07 +00:00
Tobias Grosser bb4126470a Drop option to prepare code for the BB vectorizer
The BB vectorizer is deprecated and there is no point in generating code for it
any more. This option was introduced when there was not yet any loop vectorizer
in sight. Now being matured, Polly should target the loop vectorizer.

llvm-svn: 232099
2015-03-12 20:47:58 +00:00
Tobias Grosser 3284f1975c Assert in isl expression builder if id can not be found [NFC]
llvm-svn: 231865
2015-03-10 22:35:43 +00:00
Tobias Grosser 36b8dd144d Ensure the functions in our GPURuntime are visible
llvm-svn: 231835
2015-03-10 20:23:14 +00:00
Tobias Grosser c98950671d Fix compilation after DataLayout was added to ScevExpander
The corresponding LLVM commit is 231740.

llvm-svn: 231793
2015-03-10 15:24:33 +00:00
Tobias Grosser ed61e1fcd1 Update PTX generator to latest LLVM changes
llvm-svn: 231652
2015-03-09 13:35:19 +00:00
Tobias Grosser 6e084ccda3 Shorten user report message slightly
llvm-svn: 231633
2015-03-09 06:59:16 +00:00
Johannes Doerfert f4af99bc6a [Formating] Fix formating
llvm-svn: 231612
2015-03-08 21:38:35 +00:00
Johannes Doerfert 7384399ddc [FIX] Add and force initialization for Pass * member
r231268 accidently dropped the initialization that is re-introduced
  here. The const will enforce initialization for the future.

llvm-svn: 231607
2015-03-08 20:14:34 +00:00
Johannes Doerfert e4bd53bd0c [FIX] Use the correct functions to extract the LB/UB from a range
The current tests will continue to cover this code and more will be
  added when non-affine loops are supported.

llvm-svn: 231606
2015-03-08 19:49:50 +00:00
Tobias Grosser f3c17e65d1 Drop meaningless test case
This test case was supposed to test the range analysis but it became just
another delinearization test case after enabling delinearization.

Suggested-by: Johannes Doerfert
llvm-svn: 231599
2015-03-08 16:12:47 +00:00
Johannes Doerfert 1e03f5d10d Small change to create_ll.sh [NFC]
llvm-svn: 231596
2015-03-08 15:36:27 +00:00
Tobias Grosser 6973cb6ec7 Enable delinearization by default - second try
After having fixed the LNT bugs in the previous commits, lets reenable the
delinearization.

llvm-svn: 231595
2015-03-08 15:21:18 +00:00
Tobias Grosser bf7193ae61 Update test cases to work independently of delinearization default
llvm-svn: 231594
2015-03-08 15:21:15 +00:00
Johannes Doerfert 6a4d81c1f6 Add end user report message for unprofitable regions [NFC]
llvm-svn: 231593
2015-03-08 15:11:50 +00:00
Tobias Grosser 90078c5580 Add sign-extension during codegen of index expressions
When code generating array index expressions the types of the different
components of the index expressions may not always match. We extend the type of
the index expression (if possible) and assert otherwise.

llvm-svn: 231592
2015-03-08 15:08:32 +00:00
Tobias Grosser 9d3c0b655a Revert "Enable delinearization by default"
This reverts commit 231590. Apparantly we have three more issues left
in oggenc, smg2000 and linpack.

llvm-svn: 231591
2015-03-08 12:57:31 +00:00
Tobias Grosser 16c701d0c9 Enable delinearization by default
The performance test case just committed was the last open issue I was aware of.
We enable this by default to increase test coverage and to possibly trigger
reports of issues yet unknown.

llvm-svn: 231590
2015-03-08 12:30:37 +00:00
Tobias Grosser 6e4d597e86 Add delinearization test-case that timed out earlier
llvm-svn: 231589
2015-03-08 12:07:02 +00:00
Tobias Grosser 140b394e10 Fix compilation after 'Make DataLayout Non-Optional in the Module' commit
llvm-svn: 231362
2015-03-05 09:48:20 +00:00
Tobias Grosser 1fa434992b Fix leftover Dependences.cpp -> DependenceInfo.cpp
llvm-svn: 231355
2015-03-05 06:52:42 +00:00
Johannes Doerfert 7e6424ba5a Create a dependence struct to hold dependence information for a SCoP.
The new Dependences struct in the DependenceInfo holds all information
  that was formerly part of the DependenceInfo. It also provides the
  same interface for the user to access this information.

  This is another step to a more general ScopPass interface that does
  allow multiple SCoPs to be "in flight".

llvm-svn: 231327
2015-03-05 00:43:48 +00:00
Johannes Doerfert 6745822fd1 Add missing forward declaration [NFC]
llvm-svn: 231326
2015-03-05 00:40:07 +00:00
Johannes Doerfert f6557f98a2 Rename the Dependences pass to DependenceInfo [NFC]
We rename the Dependences pass to DependenceInfo as a first step to a
  caching pass policy. The new DependenceInfo pass will later provide
  "Dependences" for a SCoP.

  To keep consistency the test folder is renamed too.

llvm-svn: 231308
2015-03-04 22:43:40 +00:00
Johannes Doerfert 3f21e27ad3 Simplify dropConstantScheduleDims [NFC]
llvm-svn: 231304
2015-03-04 22:23:21 +00:00
Tobias Grosser bb8d1562ad Remove unnecessary dynamic memory management
llvm-svn: 231281
2015-03-04 19:33:31 +00:00
Tobias Grosser 3027fedce4 Allow to build shared libraries if BUILD_SHARED_LIBS is enabled
Contributed-by: Richard Membarth <richard.membarth@uni-saarland.de>
llvm-svn: 231272
2015-03-04 18:51:27 +00:00
Tobias Grosser b021a4faad Add support for conditional 'and' and 'or' expressions
No test cases unfortunately as we do not yet generate isl_ast_op_and_then or
isl_ast_op_or_else. Those will be added in a later commit.

llvm-svn: 231268
2015-03-04 18:14:59 +00:00
David Blaikie 23f94dfdf4 Update Polly tests for the great metadata schema change
llvm-svn: 231089
2015-03-03 18:17:26 +00:00
Johannes Doerfert d239aac2ee Do not model scalar accesses in non-affine subregions
If a scalar was defined and used only in a non-affine subregion we do
  not need to model the accesses. However, if the scalar was defined
  inside the region and escapes the region we have to model the access.
  The same is true if the scalar was defined outside and used inside the
  region.

llvm-svn: 230960
2015-03-02 14:06:01 +00:00
Johannes Doerfert bbf3084561 [FIX] Make parallel codegen aware of region statements
llvm-svn: 230959
2015-03-02 13:41:53 +00:00
Johannes Doerfert de4a0fd813 [Refactor] Include explicitly what is used
llvm-svn: 230902
2015-03-01 18:51:51 +00:00
Johannes Doerfert f32d651df6 [Refactor] Include explicitly what is used
llvm-svn: 230901
2015-03-01 18:45:58 +00:00
Johannes Doerfert f94d5178a5 [Refactor] Remove Scop * member to simplify JSON class
llvm-svn: 230900
2015-03-01 18:44:57 +00:00
Johannes Doerfert 2495cfe01d [Refactor] Simplify ScopPass interface
llvm-svn: 230899
2015-03-01 18:43:50 +00:00
Johannes Doerfert 909a3bf21d [Refactor] Use virtual and override appropriately
+ Add override for overwritten methods.
  + Remove virtual for methods we do not want to be overwritten.

llvm-svn: 230898
2015-03-01 18:42:08 +00:00
Johannes Doerfert 3fe584d64f [Refactor] Add a Scop & as argument to printScop
This is the first step in the interface simplification.

llvm-svn: 230897
2015-03-01 18:40:25 +00:00
Johannes Doerfert 0200f2507e [Cleanup] Remove unused passes
llvm-svn: 230896
2015-03-01 18:38:35 +00:00
Johannes Doerfert 7b1b724c89 Update obsolete comment
llvm-svn: 230857
2015-02-28 17:10:06 +00:00
Johannes Doerfert d40991bf83 Format non-affine subregions news item
llvm-svn: 230852
2015-02-28 14:48:15 +00:00
Johannes Doerfert c28197e619 Add non-affine subregions to the news
llvm-svn: 230851
2015-02-28 14:46:26 +00:00
Johannes Doerfert 6982fa4bb0 [Fix] Two tests that broke during the last changes
llvm-svn: 230800
2015-02-27 21:58:26 +00:00
David Blaikie 47d6783913 Fix test I missed
This was & is failing at ToT, but now it's failing for the original
reason, not because the IR can't be parsed.

llvm-svn: 230797
2015-02-27 21:31:00 +00:00
David Blaikie c94eca0546 Update Polly tests to handle explicitly typed load changes in LLVM.
llvm-svn: 230796
2015-02-27 21:22:50 +00:00
David Blaikie d7b6aa3251 Update one test I missed when updating for the opaque pointer gep changes to LLVM.
llvm-svn: 230792
2015-02-27 20:43:19 +00:00
Johannes Doerfert 5079200510 Do some preparation even with scalar and phi modeling enabled
llvm-svn: 230790
2015-02-27 20:38:51 +00:00
David Blaikie bad3ff207f Update Polly tests to handle explicitly typed gep changes in LLVM
llvm-svn: 230784
2015-02-27 19:20:19 +00:00
Johannes Doerfert 514f6efa2b [FIX] Teach RegionGenerator to respect and update dominance
When we generate code for a whole region we have to respect dominance
  and update it too.
  The first is achieved with multiple "BBMap"s. Each copied block in the
  region gets its own map. It is initialized only with values mapped in
  the immediate dominator block, if this block is in the region and was
  therefor already copied. This way no values defined in a block that
  doesn't dominate the current one will be used.
  To update dominance information we check if the immediate dominator of
  the original block we want to copy is in the region. If so we set the
  immediate dominator of the current block to the copy of the immediate
  dominator of the original block.

llvm-svn: 230774
2015-02-27 18:29:04 +00:00
Johannes Doerfert 0b169c0cab Add verifier to the IslCodeGeneration
After a function was created we will verify it for Debug builds. If
  errors are found and debug-type equals "polly-codegen-isl" the SCoP,
  the isl AST, the function as well as the errors will be printed.

llvm-svn: 230767
2015-02-27 17:37:05 +00:00
Johannes Doerfert ecc33a1f67 Change argument "class" keyword to "const"
llvm-svn: 230666
2015-02-26 19:33:42 +00:00
Tobias Grosser 5e02c5f5b4 Update comment
Suggest-by: Johannes Doerfert
llvm-svn: 230642
2015-02-26 15:55:00 +00:00
Tobias Grosser f72bdbfbb1 Use isl_ast_expr_call to create run-time checks
isl recently introduced a new interface to create run-time checks from
constraint sets. Use this interface to simplify our run-time check generation.

llvm-svn: 230640
2015-02-26 15:21:10 +00:00
Tobias Grosser fa6cdc8a59 Update isl to 88d60cfe1 'add isl_ast_expr_call'
For Polly the two interesting changes are short_circuit && and || AST
expressions as well as the introduction of isl_ast_build_expr_from_set,
a well defined interface to compute ast expressions from constraint sets.

llvm-svn: 230636
2015-02-26 15:08:35 +00:00
Johannes Doerfert a36842f837 Allow non-affine control flow by default
With the patches r230325, r230329 and r230340 we can handle non-affine
  control flow in (loop-free) subregions. As all LLVM test-suite tests pass and
  we get ~20% more non-trivial SCoPs, we activate it now by default.

llvm-svn: 230624
2015-02-26 11:09:24 +00:00
Johannes Doerfert 1d8b9c1b1f Add the IMPACT2015 publications
It is important we add more publications with/about Polly so people
  can see that work and research is actually ongoing.

llvm-svn: 230552
2015-02-25 21:31:38 +00:00
Johannes Doerfert ae70ec88ae Add myself to the contributors of Polly
llvm-svn: 230546
2015-02-25 21:26:03 +00:00
Johannes Doerfert a8727861b5 Add non-affine subregions to the TODO list
llvm-svn: 230545
2015-02-25 21:20:57 +00:00
Tobias Grosser e395da7986 Update isl to 0980603 'isl_tab_pip.c: parallel_constraints: drop useless assignment'
This update contains:

  - Fixes of minor issues detected by clang's scan_build
  - More schedule tree infrastructure additions

This update slightly changes the output of our dependence analysis, but these
changes are purely syntactially.

llvm-svn: 230528
2015-02-25 19:34:52 +00:00
Tobias Grosser 6296d5ccfd Fix formatting
llvm-svn: 230504
2015-02-25 16:59:15 +00:00
Johannes Doerfert 275a1756ad Allow non-affine control flow -- Code Generation
This is the code generation for region statements that are created
  when non-affine control flow was present in the input. A new
  generator, similar to the block or vector generator, for regions is
  used to traverse and copy the region statement and to adjust the
  control flow inside the new region in the end.

llvm-svn: 230340
2015-02-24 16:16:32 +00:00
Johannes Doerfert 65971a8e72 Omit a default argument
llvm-svn: 230337
2015-02-24 16:02:16 +00:00
Johannes Doerfert 1ddb91d6f4 [FIX] Silence warning
llvm-svn: 230336
2015-02-24 16:00:41 +00:00
Johannes Doerfert 6cad9c4746 [FIX] Some comments
llvm-svn: 230335
2015-02-24 16:00:29 +00:00
Johannes Doerfert ff9d1980a7 Allow non-affine control flow -- SCoP Modeling
This allows us to model non-affine regions in the SCoP representation.
  SCoP statements can now describe either basic blocks or non-affine
  regions. In the latter case all accesses in the region are accumulated
  for the statement and write accesses, except in the entry, have to be
  marked as may-write.

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

llvm-svn: 230329
2015-02-24 12:00:50 +00:00
Johannes Doerfert e70449400f Add ScalarEvolution bounds to non-affine access functions
llvm-svn: 230328
2015-02-24 11:58:30 +00:00
Johannes Doerfert 667b77b3a1 [FIX] Create single exiting block
llvm-svn: 230326
2015-02-24 11:46:18 +00:00
Johannes Doerfert ba65c1672a Allow non-affine control flow -- SCoP Detection
With this patch we allow the SCoP detection to detect regions as SCoPs
  which have non-affine control flow inside. All non-affine regions are
  tracked and later accessible to the ScopInfo.

  As there is no real difference, non-affine branches as well as
  floating point branches are covered (and both called non-affine
  control flow).  However, the detection is restricted to
  overapproximate only loop free regions.

llvm-svn: 230325
2015-02-24 11:45:21 +00:00
Johannes Doerfert f9e3462b69 [FIX] 2 broken tests
llvm-svn: 230231
2015-02-23 16:34:20 +00:00
Johannes Doerfert 4f8ac3d123 Use ScalarEvolution to create tight bounds on the parameters
llvm-svn: 230230
2015-02-23 16:15:51 +00:00
Johannes Doerfert fb79a96d42 [NFC] Unify the use of Context.CurRegion
llvm-svn: 230222
2015-02-23 14:18:28 +00:00
Johannes Doerfert b4f08eb671 [REFACTOR] Replace Pass* from BlockGen by the DomTree
llvm-svn: 230220
2015-02-23 13:51:35 +00:00
Johannes Doerfert ca08c44a46 Remove leftover code
llvm-svn: 230140
2015-02-21 16:18:28 +00:00
Tobias Grosser f567e1aab7 Fix formatting
llvm-svn: 229920
2015-02-19 22:16:12 +00:00
Johannes Doerfert 3f1c285294 [REFACTOR] Simplify the SCoP detection interface a bit
llvm-svn: 229879
2015-02-19 18:11:50 +00:00
Johannes Doerfert 3a7e812c66 [NFC] Generalize getIslCompatibleName interface.
llvm-svn: 229877
2015-02-19 18:09:39 +00:00
Tobias Grosser d4f232f03c Drop left over code from FinalRead statement removal.
We removed FinalRead statements in r152319.

llvm-svn: 229867
2015-02-19 16:24:57 +00:00
Tobias Grosser c56dcd52be Add missing comments to member variables
Reported-by: Johannes Doerfert
llvm-svn: 229854
2015-02-19 14:28:36 +00:00
Tobias Grosser d1e33e7061 ScopDetection: Only detect scops that have at least one read and one write
Scops that only read seem generally uninteresting and scops that only write are
most likely initializations where there is also little to optimize.  To not
waste compile time we bail early.

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

llvm-svn: 229820
2015-02-19 05:31:07 +00:00
Tobias Grosser 8c45037eb4 Add missing files to autoconf build
llvm-svn: 229479
2015-02-17 08:15:14 +00:00
Tobias Grosser af4535451f Update isl to 0ae2b02 "isl_seq_combine: optimize for common case"
This is just a single commit that includes a performance optimization that
should improve dependence analysis time. Our performance bots should measure
this difference.

llvm-svn: 229476
2015-02-17 07:39:25 +00:00
Tobias Grosser 1fa7b972c0 Update to isl 99d53692ba
This commit imports the latest isl version into lib/External/isl. The changes
relavant for Polly are:

  1) Schedule trees [1] have been introduced as a more structured way to
     describe schedules. Polly does not yet use them, but we may switch to them
     in the near future.
  2) Another set of coalescing changes [2] simplifies some data dependences and
     removes a couple of code generation artifacts.

     We now understand that the following sets can be merged:

     { Stmt_S1[i0, i1] -> Stmt_S2[i0 + i1] :
          i0 >= 0 and i1 <= 1023 - i0 and i1 >= 1
       Stmt_S1[i0, 0] -> Stmt_S2[i0] : i0 <= 1023 and i0 >= 1}

     into:

     { Stmt_S1[i0, i1] -> Stmt_S2[i0 + i1] : i1 <= 1023 - i0 and i1 >= 0 and
                                             i1 >= 1 - i0 and i0 >= 0 }

     Changes of this kind reduce unnecessary specialization during code
     generation.

     -  for (int c3 = 0; c3 <= 1023; c3 += 1) {
     -    if (c3 % 2 == 0) {
     -      Stmt_for_body3(c1, c3);
     -    } else
     -      Stmt_for_body3(c1, c3);
     -  }
     +  for (int c3 = 0; c3 <= 1023; c3 += 1)
     +    Stmt_for_body3(c1, c3);

[1] http://impact.gforge.inria.fr/impact2014/papers/impact2014-verdoolaege.pdf
[2] http://impact.gforge.inria.fr/impact2015/papers/impact2015-verdoolaege.pdf

llvm-svn: 229423
2015-02-16 19:33:40 +00:00
Tobias Grosser c3fe35df4c Fix formatting
llvm-svn: 229360
2015-02-16 06:40:23 +00:00
David Blaikie c4d7bc3fcc Update Polly for the removal of LLVM_DELETED_FUNCTION now that '= delete' works on all supported compilers (MSVC2012 compat has been dropped)
llvm-svn: 229344
2015-02-15 23:40:18 +00:00
Tobias Grosser 64a399a8c7 www: update installation instructions to not include gmp/isl
llvm-svn: 229305
2015-02-15 11:19:24 +00:00
Tobias Grosser 3588b74955 Remove isl/cloog build scripts
isl is not distributed as part of Polly.

llvm-svn: 229304
2015-02-15 11:19:20 +00:00
Tobias Grosser 503a6c1570 www: Add code coverage and scan-build results again
Sylvestre Ledru (re)enabled them after the import of isl into polly
significantly simplified the build.

llvm-svn: 229303
2015-02-15 10:41:06 +00:00
Johannes Doerfert 48d75034de Add getSize() to the SCoP class.
llvm-svn: 229254
2015-02-14 12:13:17 +00:00
Johannes Doerfert 6f7921f2be Do not try to optimize empty SCoPs.
llvm-svn: 229253
2015-02-14 12:02:24 +00:00
Johannes Doerfert b6755bbd5f Overaproximate divisions in for the alias checks.
Alias checks might become costly if there are divisions that complicate the
  description of the accessed locations. By overaproximating them we get fairly
  accurate results without the huge compile time cost.

llvm-svn: 229252
2015-02-14 12:00:06 +00:00
Chandler Carruth d01918fa13 [PM] Convert Polly over to directly use the legacy pass manager
namespace and header rather than the top-level header and using
declarations. These helpers impede modular builds and are going away.
Migrating away from them will also be necessary to start mixing in any
usage of the new pass manager.

llvm-svn: 229091
2015-02-13 09:51:50 +00:00
Tobias Grosser cf33c93bd4 Link LLVM libraries into libLLVMPolly if BUILD_SHARED_LIBS=ON is set
Without this change we get linker errors such as:

  undefined reference to `llvm::dbgs()'

We only conditionally link in these libraries, as in BUILD_SHARED_LIBS=OFF mode,
linking in these libraries causes such functions (and especially global options)
to be defined twice. The "solution" I choose is most likely not ideal, but seems
to work. If any cmake specialist can suggest a better approach, this would be
appreciated.

We also drop a .c file that is not needed as it caused linker errors as well.

llvm-svn: 228914
2015-02-12 08:27:19 +00:00
Johannes Doerfert 57ef179695 [FIX] Remove XFAIL again
llvm-svn: 228868
2015-02-11 19:28:39 +00:00
Johannes Doerfert c47edb51c6 [FIX] Correctly handle scalar dependences of branch instructions
llvm-svn: 228866
2015-02-11 19:12:19 +00:00
Johannes Doerfert d594aeb248 [FIX] Fix test case that was affected by the early exit patch
llvm-svn: 228865
2015-02-11 19:11:57 +00:00
Tobias Grosser a906ee754d Drop an assert and XFAIL two test cases
This gets the buildbot green to avoid further emails. Johannes will fix this
later in the evening.

llvm-svn: 228862
2015-02-11 18:46:33 +00:00
Johannes Doerfert 05c25c2679 Update TODO list.
llvm-svn: 228858
2015-02-11 18:18:19 +00:00
Johannes Doerfert 7ceb040213 Add early exits for SCoPs we did not optimize
This allows us to skip ast and code generation if we did not optimize
  a SCoP and will not generate parallel or alias annotations. The
  initial heuristic to exit is simple but allows improvements later on.

  All failing test cases have been modified to disable early exit, thus
  to keep their coverage.

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

llvm-svn: 228851
2015-02-11 17:25:09 +00:00
Johannes Doerfert 1f87f485b1 Model scalar writes with uses outside the SCoP
These write are important as they will force the scheduling and code
  generation of an otherwise trivial statement and also impose an order of
  execution needed to guarantee the correct final value for a scalar in a loop.

  Added test case modeled after ClamAV/clamscan.

llvm-svn: 228847
2015-02-11 17:02:52 +00:00
Johannes Doerfert b9d18887d7 Allow signed devision in access functions
llvm-svn: 228833
2015-02-11 14:54:50 +00:00
Johannes Doerfert 97235c691a [FIX] Special case for branch users of scalar values
llvm-svn: 228832
2015-02-11 14:52:52 +00:00
Tobias Grosser bc8a5e2290 isl is now distributed with polly
llvm-svn: 228575
2015-02-09 13:52:21 +00:00
Johannes Doerfert 1ef52333c5 [Refactor] Use the LoopInfo object already present
llvm-svn: 228540
2015-02-08 20:50:42 +00:00
Johannes Doerfert be9c91173f [Refactor] Use only one BlockGenerator for a SCoP
This change has two main purposes:
    1) We do not use a static interface to hide an object we create and
       destroy for every basic block we copy.
    2) We allow the BlockGenerator to store information between calls to
       the copyBB method. This will ease scalar/phi code generation
       later on.

  While a lot of method signatures were changed this should not cause
  any real behaviour change.

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

llvm-svn: 228443
2015-02-06 21:39:31 +00:00
Johannes Doerfert 4a60b173a7 Do not run independent blocks when we model all scalar dependences
llvm-svn: 228441
2015-02-06 21:26:45 +00:00
Johannes Doerfert 76e37fe005 [Fix] Broken test case
llvm-svn: 228439
2015-02-06 21:20:14 +00:00
Johannes Doerfert 0ff23ec544 Model PHI nodes without demoting them
This allows us to model PHI nodes in the polyhedral description
  without demoting them. The modeling however will result in the
  same accesses as the demotion would have introduced.

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

llvm-svn: 228433
2015-02-06 20:13:15 +00:00
Tobias Grosser f85d0e217f Build the isl files as PIC
Otherwise we get linker errors.

llvm-svn: 228204
2015-02-04 21:56:28 +00:00
Tobias Grosser 52a25237d8 Import isl(+imath) as an external library into Polly
With this patch Polly is always GPL-free (no dependency on GMP any more). As a
result, building and distributing Polly will be easier. Furthermore, there is no
need to tightly coordinate isl and Polly releases anymore.

We import isl b3e0fa7a05d as well as imath 4d707e5ef2. These are the git
versions Polly currently was tested with when using utils/checkout_isl.sh. The
imported libraries are both MIT-style licensed.

We build isl and imath with -fvisibility=hidden to avoid clashes in case other
projects (such as gcc) use conflicting versions of isl. The use of imath can
temporarily reduce compile-time performance of Polly. We will work on
performance tuning in tree.

Patches to isl should be contributed first to the main isl repository and can
then later be reimported to Polly.

This patch is also a prerequisite for the upcoming isl C++ interface.

llvm-svn: 228193
2015-02-04 20:55:43 +00:00
Tobias Grosser eb29c68df2 Add test case for r227805
llvm-svn: 227970
2015-02-03 15:11:02 +00:00
Johannes Doerfert a57746b871 [NFC] Fix typo
llvm-svn: 227955
2015-02-03 08:55:01 +00:00
Johannes Doerfert 4f33706b53 [NFC] Remove some unnecessary local objects
llvm-svn: 227844
2015-02-02 19:41:30 +00:00
Johannes Doerfert 535ee97853 [FIX] Updated test case (fixed names -> regular expressions)
llvm-svn: 227807
2015-02-02 16:13:36 +00:00
Johannes Doerfert 0837c2da74 [FIX] Partially fix the pointer negation crash
llvm-svn: 227805
2015-02-02 15:25:09 +00:00
Johannes Doerfert 8cd22d4947 [FIX] Check non-deterministic isl output
llvm-svn: 227802
2015-02-02 14:07:02 +00:00
Johannes Doerfert 9282076ece [NFC] Drop the "scattering" tuple name
llvm-svn: 227801
2015-02-02 13:45:54 +00:00
Tobias Grosser c897af3ffc Correct a typo in a comment
llvm-svn: 227569
2015-01-30 12:33:43 +00:00
Johannes Doerfert 3a3799e43a [FIX] Activated a pointer test and removed obsolete comment
llvm-svn: 227524
2015-01-30 00:36:13 +00:00
Johannes Doerfert cf0e05a58f [FIX] Correct two C snippets in test cases
llvm-svn: 227407
2015-01-29 00:50:46 +00:00
Johannes Doerfert ef61def9d5 [FIX] Handle pointer-pointer comparisons
This should fix a problem introduced by r225464.

llvm-svn: 227404
2015-01-29 00:41:33 +00:00
Johannes Doerfert 9e3a5db000 [FIX] Debug build + instrinsic handling
The ignored intrinsics needed to be ignored in three other places as
  well. Tests and lnt pass now.

llvm-svn: 227092
2015-01-26 15:55:54 +00:00
Johannes Doerfert 07e8a406d6 [FIX] Independent blocks with intrinsics handling
Also an old option was removed from some new test cases

llvm-svn: 227057
2015-01-25 19:09:49 +00:00
Johannes Doerfert 3f500fa2f6 Support for math/misc intrinsics
The support is currently limited as we only allow them in the input but do
  not emit them in the transformed SCoP due to the possible semantic changes.

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

llvm-svn: 227054
2015-01-25 18:07:30 +00:00
Tobias Grosser 7a08488ca6 Drop an unused parameter
llvm-svn: 226739
2015-01-21 23:11:46 +00:00
Duncan P. N. Exon Smith e566efec71 CodeGen: Update IRBuilder for LLVM API change
`MDNode::getTemporary()` returns a `unique_ptr<>` as of r226504.

llvm-svn: 226506
2015-01-19 21:31:48 +00:00
Chandler Carruth 62975f55c8 [PM] Update Polly for LLVM r226459 which removed another pass argument
from an API in the process of preparing for the new pass manager.

llvm-svn: 226460
2015-01-19 12:37:33 +00:00
Chandler Carruth 78ae1c92ca [multilib] Teach Polly's CMake to use the libdir suffix variable. This
lets 'ninja check-polly' pass for me with a lib64 build of LLVM.

I've not updated the standalone side as I don't use it and don't have an
easy way to test any changes I've made there. I mostly wanted to be able
to actually run Polly's tests when I update its use of LLVM's APIs
during my refactorings on the (very unlikely) off chance that I make
a change which compiles but does the wrong thing.

llvm-svn: 226420
2015-01-19 01:03:05 +00:00
Tobias Grosser a8cd15249a Remove redundant semicolon clang-format complained about
llvm-svn: 226402
2015-01-18 15:59:16 +00:00
Chandler Carruth 5ec3333d24 [PM] Update Polly for LLVM r226394 and r226396 which changed some of the
block splitting interfaces to accept specific analyses rather than
a pass.

llvm-svn: 226398
2015-01-18 10:52:23 +00:00
Chandler Carruth 6adcf56b0f [PM] Update Polly for LLVM r226385 which made LoopInfo actually derive
from LoopInfoBase<...>, removing the need for the awkward getBase()
dance.

llvm-svn: 226387
2015-01-18 01:47:30 +00:00
Chandler Carruth f557987b15 [PM] Update Polly following LLVM r226373 which refactors LoopInfo in
preparation for the new pass manager.

llvm-svn: 226374
2015-01-17 14:16:56 +00:00
Chandler Carruth be742b745b [PM] Track an LLVM API change by switching this code to directly create
the wrapper pass for TLI which is now separate from the core class.

llvm-svn: 226159
2015-01-15 10:43:18 +00:00
Tobias Grosser be30c2c56e Adjust to the new explicit debug metadata
This fixes the outfall of r226048

llvm-svn: 226134
2015-01-15 07:02:12 +00:00
Chandler Carruth d281ed5109 [PM] Update for LLVM r226078 which moved TargetLibraryInfo to the
Analysis library.

llvm-svn: 226080
2015-01-15 02:17:27 +00:00
Tobias Grosser c642e95402 Use types of matching size when generating multi-dimensional address expressions
This change ensures that the values that represent the array size of a
multi-dimensional access are correctly sign-extended when used to compute a
memory address used in the run-time alias check.

To make the test case more readable, we name the instructions that we generate.

llvm-svn: 225818
2015-01-13 19:37:59 +00:00
David Peixotto dc0a11c21f Fix maxLoopDepth computation in ScopInfo
The max loop depth was incorrectly computed for scops that contain a
block from a loop but do not contain the entire loop. We need to
check that the full loop is contained in the region when computing
the max loop depth.

These scops occur when a region containing an inner loop is expanded
to include some blocks from the outer loop, but it cannot be fully
expanded to contain the outer loop because the region containing the
outer loop is invalid.

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

llvm-svn: 225812
2015-01-13 18:31:55 +00:00
Tobias Grosser 2784b0803a Check assert before the instruction that uses the assumption checked.
I did not find a good test case, as the assert should generally hold in Polly.

llvm-svn: 225582
2015-01-10 07:40:39 +00:00
Tobias Grosser 0a092763e7 Adjust test for the new 'distinct' metadata nodes
'distinct' was introduced in 225474. We now adjust the test cases
to match for the additional 'distinct' marker.

llvm-svn: 225512
2015-01-09 08:10:36 +00:00
Tobias Grosser bfbc3690bb Add experimental support for unsigned expressions
This support is still incomplete and consequently hidden behind a switch that
needs to be enabled. One problem is ATM that we incorrectly interpret very large
unsigned values as negative values even if used in an unsigned comparision.

llvm-svn: 225480
2015-01-09 00:01:33 +00:00
Tobias Grosser 55bc4c0767 Add support for pointer types in expressions
llvm-svn: 225464
2015-01-08 19:26:53 +00:00
Tobias Grosser 021eaef044 Fix a crash in our error reporting
AF = dyn_cast<SCEVAddRecExpr>(Pair.second) may be NULL for some SCEVs that we do
not support. When reporting the error we still want to pass a pointer that is
known to always be non-NULL.

I do not yet have a test case for this, unfortunately.

llvm-svn: 225461
2015-01-08 19:03:10 +00:00
Tobias Grosser 37c93a9323 todo: Remove some redundant topics
llvm-svn: 225395
2015-01-07 21:28:44 +00:00
Tobias Grosser 1016991083 www: Make sure the main content pane does not overlap with the menu
llvm-svn: 225391
2015-01-07 21:21:55 +00:00
Tobias Grosser f7273badba todo: Adding native OpenSCoP support to Polly does not seem desirable
This would add another library dependency to Polly. In many cases the
JSCoP interface we have should be enough and an external JSCoP <> OpenSCoP
converter could be written. We can reconsider this if new use cases show up.

llvm-svn: 225390
2015-01-07 21:18:35 +00:00
Tobias Grosser 03e6476693 Add updated TODO list
llvm-svn: 225388
2015-01-07 21:16:33 +00:00
Tobias Grosser 314587d743 Use explicit StringRef Type
We previously used a Twine here, but as pointed out by David Blaikie
and Mehdi Amini storing a temporary StringRef in a Twine is not a good
idea, as the StringRef will be freed before the Twine is used leaving
a Twine that points to uninitialized memory. We now make it explicit that
we use a StringRef here.

llvm-svn: 225342
2015-01-07 07:43:34 +00:00
Tobias Grosser 5dfcb1a7e0 Do not use a const Twine here
This has caused segfaults when using Polly in the context of Julia, that are
not reproducible on my machine in 'make check-polly'.

llvm-svn: 225326
2015-01-07 00:30:01 +00:00
Tobias Grosser 80f6f11330 Make registerPollyPasses public
This function is needed for the integration of Polly into Julia.

llvm-svn: 225295
2015-01-06 20:40:33 +00:00
Tobias Grosser f8ae533f3d www: Draft changelog for the upcoming release.
llvm-svn: 225264
2015-01-06 12:57:44 +00:00
Tobias Grosser 6252bc8819 Fix html
llvm-svn: 225263
2015-01-06 12:31:31 +00:00
Tobias Grosser 67a8a7a94c We currently do not create these result for polly
We should reconsider this after having switched to imath (instead of gmp)
as the default isl backend, as this would allow us to keep a copy of isl
in the polly svn and to consequently make it easier to distribute Polly.

llvm-svn: 225262
2015-01-06 12:30:26 +00:00
Tobias Grosser 3f29619614 Drop all constant scheduling dimensions
Schedule dimensions that have the same constant value accross all statements do
not carry any information, but due to the increased dimensionality of the
schedule cost compile time. To not pay this cost, we remove constant dimensions
if possible.

llvm-svn: 225067
2015-01-01 23:01:11 +00:00
Andreas Simbuerger cd8500e500 (diagnostics) fix typo in test...
llvm-svn: 224591
2014-12-19 17:22:46 +00:00
Andreas Simbuerger 6492b700c3 (diagnostics) Fix typo.
Thanks Albert Cohen.

llvm-svn: 224584
2014-12-19 16:49:39 +00:00
Tobias Grosser 11e3873516 Dead code elimination: Update dependences after eliminating code
Without updating dependences we may lose implicit transitive dependences for
which all explicit dependences have gone through the statement iterations we
have just eliminated.

No test case. We should probably implement a -verify-dependences option.

This fixes llvm.org/PR21227

llvm-svn: 224459
2014-12-17 21:13:55 +00:00
Duncan P. N. Exon Smith 39e21f9c27 Hand-modify a testcase (still PR21532)
Bot was still tripping [1] on a testcase the upgrade script didn't
handle in 224269.  This is still fallout from r224257.

[1]: http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25435

llvm-svn: 224280
2014-12-15 21:43:20 +00:00
Duncan P. N. Exon Smith bd62edb20d Run upgrade script from PR21532 to match LLVM changes
Update tests for LLVM assembly format change in r224257 using the script
attached to PR21532.  I'm hoping this unsticks the bot [1].

[1]: http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25432

llvm-svn: 224269
2014-12-15 20:28:50 +00:00
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