Commit Graph

282 Commits

Author SHA1 Message Date
Johannes Doerfert c4968e508b [Refactor] IslAst and payload struct
+ Renamed context into build when it's the isl_ast_build
  + Use the IslAstInfo functions to extract the schedule of a node
  + Use the IslAstInfo functions to extract the build/context of a node
  + Move the payload struct into the IslAstInfo class
  + Use a constructor and destructor (also new and delete) to
    allocate/initialize the payload struct

llvm-svn: 213792
2014-07-23 20:17:28 +00:00
Johannes Doerfert f6583176ab [Refactor] Unify IslAst print methods
+ Add const annotations to some member functions

llvm-svn: 213779
2014-07-23 18:14:43 +00:00
Johannes Doerfert 6e81905ece [Refactor] Move code out of the IslAst header
Offer the static functions to extract information out of an IslAst for node
  as members of IslAstInfo not as top level entities.

  + Refactor common code
  + Add isParallel and isReductionParallel
  + Rename IslAstUser to IslAstUserPayload to make it clear this is just a (or
    the) payload struct.

llvm-svn: 213272
2014-07-17 16:11:28 +00:00
Johannes Doerfert 43e1eadf26 [Refactor] Use attributes to mark function as invalid for polly
+ Test case annotated with the new attribute
  + Modified test case to check if subfunctions are annotated

llvm-svn: 213093
2014-07-15 21:06:48 +00:00
Johannes Doerfert 457f73eaee Annotate reduction parallel loops in the IslAst textual output
+ Introduced dependency type TYPE_TC_RED to represent the transitive closure
    (& the reverse) of reduction dependences. These are used when we check for
    reduction parallel loops.
  + Test cases including loop reversals and modulo schedules which compute
    reductions in a alternated order.

llvm-svn: 213019
2014-07-15 00:00:35 +00:00
Tobias Grosser 780ce0f8e3 DeadCodeElim: Compute correct liveout for non-affine accesses
Thanks to Johannes Doerfert for narrowing down the bug.

Reported-by: Chris Jenneisch <chrisj@codeaurora.org>
llvm-svn: 212796
2014-07-11 07:12:10 +00:00
Tobias Grosser 483a90d1bd clang-format polly to avoid buildbot noise
llvm-svn: 212609
2014-07-09 10:50:10 +00:00
Tobias Grosser 5e6813d184 Derive run-time conditions for delinearization
As our delinearization works optimistically, we need in some cases run-time
checks that verify our optimistic assumptions. A simple example is the
following code:

void foo(long n, long m, long o, double A[n][m][o]) {

  for (long i = 0; i < 100; i++)
    for (long j = 0; j < 150; j++)
      for (long k = 0; k < 200; k++)
        A[i][j][k] = 1.0;
}

After clang linearized the access to A and we delinearized it again to
A[i][j][k] we need to ensure that we do not access the delinearized array
out of bounds (this information is not available in LLVM-IR). Hence, we
need to verify the following constraints at run-time:

CHECK:   Assumed Context:
CHECK:   [o, m] -> {  : m >= 150 and o >= 200 }
llvm-svn: 212198
2014-07-02 17:47:48 +00:00
Tobias Grosser ce67a044e0 Use arguments of user statements to perform induction variable substitution
To translate the old induction variables as they exist before Polly to new
new induction variables introduced during AST code generation we need to
generate code that computes the new values from the old ones. We can do this
by just looking at the arguments isl generates in each scheduled statement.

Example:

  // Old
  for i
    S(i)

  // New
  for c0
    for c1
      S(c0 + c1)

To get the value of i, we need to compute 'c0 + c1'. This expression is readily
available in the user statements generated by isl and just needs to be
translated to LLVM-IR.

This replaces an old confusing construct that constructed during ast generation
an isl multi affine expression that described this relation and which was then
again ast generated for each statement and argument when translating the isl ast
to LLVM-IR. This approach was difficult to understand and the additional ast
generation calls where entirely redundant as isl provides the relevant
expressions as arguments of the generated user statements.

llvm-svn: 212186
2014-07-02 16:26:47 +00:00
Johannes Doerfert f618339a37 Introduce reduction types
This change is particularly useful in the code generation as we need
  to know which binary operator/identity element we need to combine/initialize
  the privatization locations.

  + Print the reduction type for each memory access
  + Adjusted the test cases to comply with the new output format and
    to test for the right reduction type

llvm-svn: 212126
2014-07-01 20:52:51 +00:00
Johannes Doerfert e58a012094 Allow multiple reductions per statement
Iterate over all store memory accesses and check for valid binary reduction
  candidate loads by following the operands of the stored value.  For each
  candidate pair we check if they have the same base address and there are no
  other accesses which may overlap with them. This ensures that no intermediate
  value can escape into other memory locations or is overwritten at some point.

  + 17 test cases for reduction detection and reduction dependency modeling

llvm-svn: 211957
2014-06-27 20:31:28 +00:00
Andreas Simbuerger b379edbb3e Don't expand to invalid Scops with -polly-detect-keep-going
Enabling -keep-going in ScopDetection causes expansion to an invalid
Scop candidate.

Region A     <- Valid candidate
   |
Region B     <- Invalid candidate

If -keep-going is enabled, ScopDetection would expand A to A+B because
the RejectLog is never checked for errors during expansion.

With this patch only A becomes a valid Scop.

llvm-svn: 211875
2014-06-27 06:21:14 +00:00
Johannes Doerfert 1530adffdd [Refactor] Make the used dependence types explicit
llvm-svn: 211803
2014-06-26 20:24:17 +00:00
Johannes Doerfert ea23b1d561 Hybrid dependency analysis
This dependency analysis will keep track of memory accesses if they might be
  part of a reduction. If not, the dependences are tracked on a statement level.
  The main reason to do this is to reduce the compile time while beeing able to
  distinguish the effects of reduction and non-reduction accesses.

  + Adjusted two test cases

llvm-svn: 211794
2014-06-26 18:38:08 +00:00
Andreas Simbuerger 5bf774ce0e Use own class for storing the RejectLogs
Use a container class to store the reject logs. Delegating most calls to
the internal std::map and add a few convenient shortcuts (e.g.,
hasErrors()).

llvm-svn: 211780
2014-06-26 13:36:52 +00:00
Andreas Simbuerger 99d4ab2b84 Add diagnostic remark for ReportVariantBasePtr
llvm-svn: 211777
2014-06-26 13:33:35 +00:00
Andreas Simbuerger aee4541828 Fix dangling reference
llvm-svn: 211773
2014-06-26 11:09:13 +00:00
Andreas Simbuerger e2c924366c Support for LLVM-style RTTI isa<...>, dyn_cast<...> et al.
llvm-svn: 211770
2014-06-26 10:19:57 +00:00
Andreas Simbuerger 5569bf300d Support the new DiagnosticRemarks
Add support for generating optimization remarks after completing the
detection of Scops.
The goal is to provide end-users with useful hints about opportunities that
help to increase the size of the detected Scops in their code.

By default the remark is unspecified and the debug location is empty. Future
patches have to expand on the messages generated.

This patch brings a simple test case for ReportFuncCall to demonstrate the
feature.

Reports all missed opportunities to increase the size/number of valid
Scops:
 clang <...> -Rpass-missed="polly-detect" <...>
 opt <...> -pass-remarks-missed="polly-detect" <...>

Reports beginning and end of all valid Scops:
 clang <...> -Rpass="polly-detect" <...>
 opt <...> -pass-remarks="polly-detect" <...>

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

llvm-svn: 211769
2014-06-26 10:06:40 +00:00
Yabin Hu cc91169fd7 Remove use of llvm.codegen intrinsic for GPGPU codegen
We use llvm.codegen intrinsic to generate code for embedded LLVM-IR
strings. The reason we introduce such a intrinsic is that previous
clang/opt tools was NOT linked with various LLVM targets and their
AsmParsers and AsmPrinters. Since clang/opt been linked with all the
needed libraries, we no longer need the llvm.codegen intrinsic.

llvm-svn: 211573
2014-06-24 08:11:36 +00:00
Johannes Doerfert 5ec80c2a85 [Refactor] Simplify memory access isWrite
llvm-svn: 211379
2014-06-20 17:06:41 +00:00
Johannes Doerfert ffa73bd44c Reduction like is now a memory access property
- Remove the statement reduction like property
+ Add the reduction like property to memory accesses

llvm-svn: 211372
2014-06-20 16:58:12 +00:00
Johannes Doerfert f1906138b4 Model statement wise reduction dependences
+ Collect reduction dependences
+ Introduced TYPE_RED in Dependences.h which can be used to obtain the
  reduction dependences
+ Used TYPE_RED to prevent parallelization while we do not have a privatizing
  code generation
+ Relax the dependences for non-parallel code generation
+ Add privatization dependences to ensure correctness
+ 12 Test cases to check for reduction and privatization dependences

llvm-svn: 211369
2014-06-20 16:37:11 +00:00
Johannes Doerfert 0ee1f21478 Subject: [PATCH-v5] Detect and mark reduction like statements
+ Flag to indicate reduction like statements
+ Command line option to (dis)allow multiplicative reduction opcodes
+ Two simple positive test cases, one fp test case w and w/o fast math
+ One "negative" test case (only reduction like but no reduction)

llvm-svn: 211114
2014-06-17 17:31:36 +00:00
Johannes Doerfert f675289d87 [Refactor] C++11 Memory access iterators in SCoP stmts
+ Added const iterator version
+ Changed name to begin/end to allow range loops
+ Changed call sites to range loops
+ Changed typename to (const_)iterator

llvm-svn: 210927
2014-06-13 18:01:45 +00:00
Andreas Simbuerger 06904d8554 Do not use namespace polly inside a header.
In general this fixes ambiguity that can arise from using
a different namespace that declares the same symbols as
we do.

One example inside llvm would be:
  createIndVarSimplifyPass(..);

Which can be found in:
  llvm/Transforms/Scalar.h
and
  polly/LinkAllPasses.h

llvm-svn: 210755
2014-06-12 07:26:25 +00:00
Andreas Simbuerger fbd643c9e1 Move getDebugLocation to ScopDetectionDiagnostic
llvm-svn: 210752
2014-06-12 07:23:04 +00:00
Sebastian Pop 422e33f363 record delinearization result and reuse it in polyhedral translation
Without this patch, the testcase would fail on the delinearization of the second
array:

; void foo(long n, long m, long o, double A[n][m][o]) {
;   for (long i = 0; i < n; i++)
;     for (long j = 0; j < m; j++)
;       for (long k = 0; k < o; k++) {
;         A[i+3][j-4][k+7] = 1.0;
;         A[i][0][k] = 2.0;
;       }
; }

; CHECK: [n, m, o] -> { Stmt_for_body6[i0, i1, i2] -> MemRef_A[3 + i0, -4 + i1, 7 + i2] };
; CHECK: [n, m, o] -> { Stmt_for_body6[i0, i1, i2] -> MemRef_A[i0, 0, i2] };

Here is the output of FileCheck on the testcase without this patch:

; CHECK: [n, m, o] -> { Stmt_for_body6[i0, i1, i2] -> MemRef_A[i0, 0, i2] };
         ^
<stdin>:26:2: note: possible intended match here
 [n, m, o] -> { Stmt_for_body6[i0, i1, i2] -> MemRef_A[o0] };
 ^

It is possible to find a good delinearization for A[i][0][k] only in the context
of the delinearization of both array accesses.

There are two ways to delinearize together all array subscripts touching the
same base address: either duplicate the code from scop detection to first gather
all array references and then run the delinearization; or as implemented in this
patch, use the same delinearization info that we computed during scop detection.

llvm-svn: 210117
2014-06-03 18:16:31 +00:00
Daniel Jasper 66f6f804e5 Remove superfluous semicolon confusing clang-format.
llvm-svn: 210016
2014-06-02 11:29:58 +00:00
Sebastian Pop bc9009a20a pass element size to delinearization
Instead of relying on the delinearization to infer the size of an element,
compute the element size from the base address type. This is a much more precise
way of computing the element size than before, as we would have mixed together
the size of an element with the strides of the innermost dimension.

llvm-svn: 209695
2014-05-27 22:42:09 +00:00
Andreas Simbuerger f6ee78cfb7 Expose diagnostic info to users
llvm-svn: 209575
2014-05-24 09:25:14 +00:00
Andreas Simbuerger 0447240ee9 ScopDetection: Support keep-going
Support a 'keep-going' mode for the ScopDetection. In this mode, we just keep
on detecting, even if we encounter an error.

This is useful for diagnosing SCoP candidates. Sometimes you want all the
errors. Invalid SCoPs will still be refused in the end, we just refuse to
abort on the first error.

llvm-svn: 209574
2014-05-24 09:25:10 +00:00
Andreas Simbuerger 8a00c9bb0f Substitue LastError & InvalidRegions with RejectLogs
Use the new ScopDetectionDiagnostics to implement
the same functionality.

llvm-svn: 209573
2014-05-24 09:25:06 +00:00
Andreas Simbuerger 4870e091ec Store all RejectReasons that occurred in a log.
This stores all RejectReasons created for one region
in a RejectLog inside the DetectionContext. For now
this only keeps track of the last error.

A separate patch will enable the tracking of all errors.
This patch itself does no harm (yet).

llvm-svn: 209572
2014-05-24 09:25:01 +00:00
Andreas Simbuerger 320af405d6 Split implementation from ScopDetectionDiagnostic.h
We don't want the Statistic variables in every module that
includes the diagnostics.

llvm-svn: 209571
2014-05-24 09:24:53 +00:00
Sebastian Pop e8863b8f00 correct the delinearization failing case
collect terms from affine and non affine memory accesses

llvm-svn: 208616
2014-05-12 19:02:02 +00:00
Sebastian Pop 46e1ecdecc delinearize together all accesses to the same array
llvm-svn: 208457
2014-05-09 22:45:15 +00:00
Tobias Grosser 5e54810d37 Remove superflous semicolon
llvm-svn: 208208
2014-05-07 13:49:14 +00:00
Tobias Grosser a2125140ae Replace llvm::IRBuilder with PollyIRBuilder
Contributed-by:  Yabin Hu <yabin.hwu@gmail.com>
llvm-svn: 208182
2014-05-07 10:06:42 +00:00
Chandler Carruth 95fef9446c [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE
definition below all of the header #include lines, Polly edition.

If you want to know more details about this, you can see the recent
commits to Debug.h in LLVM. This is just the Polly segment of a cleanup
I'm doing globally for this macro.

llvm-svn: 206852
2014-04-22 03:30:19 +00:00
Tobias Grosser b24cf90645 Remove OpenScop
We only supported a very old version of OpenScop that was entirely different
to what OpenScop is today. To not confuse people, we remove this old and
unusable support. If anyone is interested to add OpenScop support back in,
the relevant patches are available in version control.

llvm-svn: 206026
2014-04-11 09:47:45 +00:00
Tobias Grosser 79baa21242 ScopInfo: Scalar accesses are zero dimensional
llvm-svn: 205958
2014-04-10 08:38:02 +00:00
Tobias Grosser 6defb5bd6d ScopInfo: Some code cleanup
llvm-svn: 205957
2014-04-10 08:37:44 +00:00
Sebastian Pop 1801668af3 delinearize memory access functions
llvm-svn: 205799
2014-04-08 21:20:44 +00:00
Andreas Simbuerger 01a37a0bcc Replace INVALID/INVALID_NOVERIFY with diagnostics.
This replaces the ancient INVALID/INVALID_NOVERIFY macros with a real
function.

The new invalid(..) function uses small diagnostic objects that are
generated on demand. We can store arbitrary additional information per
error type and generate useful debug/error messages on the fly.

Use it as follows:
  if (/* Some error condition (ReportFoo) */)
    invalid<ReportFoo>(Context, /*Assert=*/true/false,
      (/* List of helpful diagnostic objects */));

Where ReportFoo is a subclass of RejectReason that is able to take the
list of helpful diagnostic objects in its constructor.
The implementation of invalid will create the report and fire
an assertion, if necessary.

llvm-svn: 205414
2014-04-02 11:54:01 +00:00
Tobias Grosser 2f4529f864 clang-format: Remove empty lines
llvm-svn: 204468
2014-03-21 14:04:25 +00:00
Tobias Grosser 0dd463facf Support for generating vectors for loads with -1 stride
This patch enables vectorization of loops containing backward array
traversal (array stride is -1).

Contributed-by: Chris Jenneisch <chrisj@codeaurora.org>
llvm-svn: 204257
2014-03-19 19:27:24 +00:00
Tobias Grosser 806e9fff60 Move Pass registration into polly library
This ensures that the polly passes get properly registered both, when using
polly as a loadable module and when directly linking it into clang/opt/bugpoint.

llvm-svn: 204255
2014-03-19 17:54:23 +00:00
Tobias Grosser ab38488c96 Ported scoplib to use isl_val * instead of isl_int
1) The isl_int -> isl_val changes are the ones Tobias suggested.
   One additional isl_val_free is added (and needed)
2) Three scoplib_vector_free are added, maybe we would need even
   more (and matrix_free) but it's hard to place them right.
3) Cleaned the includes (and removed 'extern C')

This fixes the broken compilation for the scoplib import and export.

Contributed-by: Johannes Doerfert <doerfert@cs.uni-saarland.de>
llvm-svn: 203500
2014-03-10 22:03:30 +00:00
Sebastian Pop 9cce17a23a remove unused code
llvm-svn: 203163
2014-03-06 20:59:18 +00:00
Tobias Grosser 7ff8ae8967 Fix formatting
llvm-svn: 202856
2014-03-04 15:57:29 +00:00
Tobias Grosser 9e400b076f Always name instructions
We currently need to always name instructions, as the polly test suite currently
matches for certain names. We should improve the test suite at some point.

This fixes 'make check-polly' in NDEBUG builds.

llvm-svn: 202855
2014-03-04 15:43:57 +00:00
Tobias Grosser 37c9b8e0f2 Emit llvm.loop metadata for parallel loops
For now we only mark innermost loops for the loop vectorizer.  We could later
also mark not-innermost loops to enable the introduction of openmp parallelism.

llvm-svn: 202854
2014-03-04 14:59:00 +00:00
Tobias Grosser 5103ba7c91 Introduce PollyIRBuilder
PollyIRBuilder is currently just a typedef to IRBuilder<>. Consequently, this
change should not affect behavior. In subsequent patches we will extend its
functionality to emit loop.parallel metadata.

llvm-svn: 202853
2014-03-04 14:58:49 +00:00
Tobias Grosser 2c1a81aefd cmake: Split off functionality for LLVM loadable module
This fixes the buildbots who failed, because the linker eliminated most of the
Polly functionality when building without BUILD_SHARED_LIBS=ON.

Besides fixing the build, this change also brings additional functionality. With
the new separation between the general polly libraries and the functionality for
the polly module, it is now possible to link polly directly into a tool instead
of using requiring users to load a shared library.

llvm-svn: 202762
2014-03-03 21:58:50 +00:00
Tobias Grosser 45bac0d953 Use C++11 formatting
clang-formats behaviour has changed for a couple of C++11 formattings. We adapt
Polly to ensure our formatting checks are clean again.

llvm-svn: 202650
2014-03-02 17:05:21 +00:00
Rafael Espindola c5d1689b45 Update for llvm api change.
llvm-svn: 202183
2014-02-25 19:17:57 +00:00
Tobias Grosser 38c36ea18e Do not fail in case we do not have valid dependences
In case we do not have valid dependences, we do not run dead code elimination or
the schedule optimizer. This fixes an infinite loop in the dead code
elimination (PR12110).

llvm-svn: 201982
2014-02-23 15:15:44 +00:00
Sebastian Pop bfec361cae GMP is only required for CLooG
llvm-svn: 201925
2014-02-22 02:15:39 +00:00
Tobias Grosser 37eb422f69 Add polyhedral dead code elimination.
This pass eliminates loop iterations that compute results that are not used
later on. This can help e.g. in D, where the default zero-initialization is
often unnecessary if right after new values are assigned to an array.

Contributed-by: Peter Conn <conn.peter@gmail.com>
llvm-svn: 201817
2014-02-20 21:43:54 +00:00
Tobias Grosser a1689937ba Check scops a second time before working on them
In rare cases the modification of one scop can effect the validity of other
scops, as code generation of an earlier scop may make the scalar evolution
functions derived for later scops less precise. The example that triggered this
patch was a scop that contained an 'or' expression as follows:

  %add13710 = or i32 %j.19, 1
    -->  {(1 + (4 * %l)),+,2}<nsw><%for.body81>

Scev could only analyze the 'or' as it knew %j.19 is a multiple of 2. This
information was not available after the first scop was code generated (or
independent-blocks was run on it) and SCEV could not derive a precise SCEV
expression any more. This means we could not any more code generate this SCoP.
My current understanding is that there is always the risk that an earlier code
generation change invalidates later scops.  As the example we have seen here is
difficult to avoid, we use this occasion to guard us against all such
invalidations.

This patch "solves" this issue by verifying right before we start working on
a detected scop, if this scop is in fact still valid. This adds a certain
overhead. However the verification we run is anyways very fast and secondly
it is only run on detected scops. So the overhead should not be very large. As
a later optimization we could detect scops only on demand, such that we need
to run scop-detections always only a single time.

This should fix the single last failure in the LLVM test-suite for the new
scev-based code generation.

llvm-svn: 201593
2014-02-18 18:49:49 +00:00
Tobias Grosser 9b1100b305 Add ScopDetection::isValidRegion(Region)
llvm-svn: 201592
2014-02-18 18:49:46 +00:00
Tobias Grosser 86070d226b Remove MayAliasSet class
The MayAliasSet class is currently not used and just confuses people. We can
reintroduce it in case need a more precise tracking of alias sets.

llvm-svn: 201191
2014-02-11 23:34:40 +00:00
Tobias Grosser e200d58ad7 Add missing doxygen comment
llvm-svn: 200410
2014-01-29 19:05:22 +00:00
Tobias Grosser 458fb78cfa Check if array base addresses are invariant
Array base addresses need to be invariant in the region considered. The base
address has to be computed outside the region, or, when it is computed inside,
the value must not change with the iterations of the loops. For example, when a
two-dimensional array is represented as a pointer to pointers the base address
A[i] in an access A[i][j] changes with i; therefore, such regions have to be
rejected.

Contributed by:  Armin Größlinger <armin.groesslinger@uni-passau.de>

llvm-svn: 200314
2014-01-28 12:58:58 +00:00
Tobias Grosser 63c6b45a5a Temporarily reformat Polly to silence buildbots
We may revert this depending on how the current discussion on llvm-commits
ends.

llvm-svn: 198581
2014-01-06 01:37:13 +00:00
Tobias Grosser ca7887d729 Another formatting fix
llvm-svn: 198386
2014-01-03 00:56:20 +00:00
Tobias Grosser 765a70abab Fix formatting issues
llvm-svn: 198384
2014-01-03 00:44:43 +00:00
Tobias Grosser a9376ff571 Introduce -polly-canonicalize pass
This ModulePass schedules the set of Polly canonicalization passes. It is a
debugging tool that can be used to preoptimize .ll files for Polly processing.

llvm-svn: 198376
2014-01-02 23:39:18 +00:00
Tobias Grosser 54ee0ba74d IslCodegen: Support for run-time conditions
llvm-svn: 194948
2013-11-17 03:18:25 +00:00
Tobias Grosser 1c84d80457 Style fixes, brought to you by clang-format
llvm-svn: 194910
2013-11-16 01:07:06 +00:00
Andy Gibbs 78fc064b1a PassManagerBase has moved into the legacy namespace as of r194324; match it here.
llvm-svn: 194490
2013-11-12 17:10:46 +00:00
Tobias Grosser d764fcbd5a Update comments to address Sebastian's review
llvm-svn: 193741
2013-10-31 11:50:52 +00:00
Tobias Grosser e86109f508 ScopInfo: Add support for AssumedContext
When constructing a scop sometimes the exact representation of a statement or
condition would be very complex, but there is a common case which is a lot
simpler, but which is only valid under certain assumptions. The assumed context
records the assumptions taken during the construction of this scop and that need
to be code generated as a run-time test.

At the moment, we do not yet model any assumptions, but only added the
AssumedContext as well as the isl-ast generation support. As a next step,
this needs to be hooked up with the isl code generation.

if (1) /* run-time condition */
  {  /* optimized code */ }
else
  {  /* original code */ }

llvm-svn: 193652
2013-10-29 21:05:49 +00:00
Tobias Grosser dd6dc8276f clang-format: No empty line after 'public:'
llvm-svn: 192710
2013-10-15 14:41:02 +00:00
Tobias Grosser 51b78752fe Use LLVM_DELETED_FUNCTION instead of a comment
Contributed-by:  Michael Kruse  <MichaelKruse@meinersbur.de>
llvm-svn: 191894
2013-10-03 13:09:14 +00:00
Tobias Grosser abe9193b6b ScopInfo: Fix typos
Contributed-by:  Michael Kruse  <MichaelKruse@meinersbur.de>
llvm-svn: 191892
2013-10-03 13:08:59 +00:00
Hongbin Zheng 5b463ceaf5 BlockGenerator: Split getNewValue.
Split the old getNewValue into two parts:

1. The function "lookupAvailableValue" that return the new version of
the instruction which is already available.

2. The function calls "lookupAvailableValue", and tries to generate
the new version if it is not available yet.

llvm-svn: 187114
2013-07-25 09:12:07 +00:00
Tobias Grosser c7d3fc5547 ScopDetect: Only track detection failures if actually needed.
String operations resulted by raw_string_ostream in the INVALID macro can lead
to significant compile-time overhead when compiling large size source code.
This is because raw_string_ostream relies on TypeFinder class, whose
compile-time cost increases as the size of the module increases. This patch
targets to ensure that it only track detection failures if actually needed.
In this way, we can avoid expensive string operations in normal execution.

With this patch file, the relative compile-time cost of Polly-detect pass does
not increase even when compiling very large size source code.

Contributed-by:   Star Tan <tanmx_star@yeah.net>
llvm-svn: 187102
2013-07-25 03:02:29 +00:00
Hongbin Zheng 63cc9467af Ensure a correct order between memory accesses.
Ensure that the scalar write access corresponds to the result of a load
instruction appears after the generic read access corresponds to the load
instruction.

llvm-svn: 186419
2013-07-16 15:20:29 +00:00
Tobias Grosser 001bd274f5 Dependences: Use ostream printer to print analysis output
llvm-svn: 186288
2013-07-14 18:09:40 +00:00
Tobias Grosser 8c895b4248 Support: No need to comment __isl_keep
llvm-svn: 186281
2013-07-14 06:59:38 +00:00
Tobias Grosser b58f6a4211 ScopInfo: Add getTupe() method to MemoryAccess
We also move the enum to UPPERCASE.

llvm-svn: 186259
2013-07-13 20:41:24 +00:00
Tobias Grosser 14a3999354 clang-format latest changes
llvm-svn: 185440
2013-07-02 16:13:07 +00:00
Hongbin Zheng 8d3a888ca3 TempScop: (Partial) Implement the printDetail function.
llvm-svn: 185254
2013-06-29 07:00:14 +00:00
Hongbin Zheng b5f24a665e Refactor memory access getting code in ScopStmt.
1. Do not allow creating new memory access record in the InstructionToAccess map
   on the fly in function getAccessFor.
2. Do not allow user to modify the memory accesses returned by getAccessFor
   during the code generation process.

llvm-svn: 185253
2013-06-29 06:31:39 +00:00
Tobias Grosser 4f96749351 ScopInfo: Clarify may-write and must-write accesses
llvm-svn: 184658
2013-06-23 05:21:18 +00:00
Tobias Grosser 58032cb029 Integrate latest clang-format changes
llvm-svn: 184655
2013-06-23 01:29:29 +00:00
Tobias Grosser edab1359a0 Use isl_val instead of isl_int in the core of Polly
isl recently introduced isl_val as an abstract interface to represent arbitrary
precision numbers. This interface superseeds the old isl_int interface. In
contrast to the old interface which implemented arbitrary precision arithmetic
using macros that forward to the gmp library, the new library hides the math
library implementation in isl. This allows us to switch the math library used by
isl without affecting users such as Polly.

llvm-svn: 184529
2013-06-21 06:41:31 +00:00
Tobias Grosser c5f290f6c6 Fix typo in header guards
Found by the new -Wheader-guard warning.

llvm-svn: 184047
2013-06-15 18:52:49 +00:00
Sebastian Pop 8ca899c781 scop detection: inline and remove isValidBasicBlock
llvm-svn: 184001
2013-06-14 20:20:43 +00:00
Hongbin Zheng 599782bb6c TempScopInfo: Add code to build the scalar dependences.
llvm-svn: 183653
2013-06-10 13:55:34 +00:00
Hongbin Zheng d1fdf0b180 Refactor: Move the IRAccess building code to a new function.
llvm-svn: 183635
2013-06-10 02:52:30 +00:00
Tobias Grosser 5db6ffd76f LoopGenerators: Construct loops such that they are already loop rotated
BeforeBB
                   |
                   v
                GuardBB
                /      \
       __  PreHeaderBB  \
      /  \    /         |
   latch  HeaderBB      |
      \  /    \         /
       <       \       /
                \     /
                ExitBB

This does not only remove the need for an explicit loop rotate pass, but it also
gives us the possibility to skip the construction of the guard condition in case
the loop is known to be executed at least once. We do not yet exploit this, but
by implementing this analysis in the isl code generator we should be able to
remove more guards than the generic loop rotate pass can.  Another point is that
loop rotation can introduce additional PHI nodes, which may hide that a loop can
be executed in parallel. This change avoids this complication and will make it
easier to move the openmp code generation into a separate pass.

llvm-svn: 181986
2013-05-16 06:40:06 +00:00
Tobias Grosser 637bd63123 Move polly options into separate option category
Use the new cl::OptionCategory support to move the Polly options into a separate
option category. The aim is to hide most options and show by default only the
options a user needs to influence '-O3 -polly'. The available options probably
need some care, but here is the current status:

Polly Options:
Configure the polly loop optimizer

  -enable-polly-openmp              - Generate OpenMP parallel code
  -polly                            - Enable the polly optimizer (only at -O3)
  -polly-no-tiling                  - Disable tiling in the scheduler
  -polly-only-func=<function-name>  - Only run on a single function
  -polly-report                     - Print information about the activities
                                      of Polly
  -polly-vectorizer                 - Select the vectorization strategy
    =none                           -   No Vectorization
    =polly                          -   Polly internal vectorizer
    =unroll-only                    -   Only grouped unroll the vectorize
                                        candidate loops
    =bb                             -   The Basic Block vectorizer driven by
                                        Polly

llvm-svn: 181295
2013-05-07 07:31:10 +00:00
Tobias Grosser e602a07662 Reformat with clang-format
clang-format become way more stable. This time we mainly reformat function
signatures.

llvm-svn: 181294
2013-05-07 07:30:56 +00:00
Tobias Grosser b5f92892d1 Remove unneeded RegionSimplify pass.
We now support regions with multiple entries and multiple exits natively.
Regions are not needed to be simplified to single entry and single exit.

We need to XFAIL two test cases as this change increases the scop coverage
and uncoveres two failures in the independent blocks pass. The first failure
will be fixed in a subsequent commit, the second one is in the non-default
-polly-codegen-scev mode and still needs to be fixed.

Contributed-by: Star Tan <tanmx_star@yeah.net>
llvm-svn: 179673
2013-04-17 07:20:30 +00:00
Tobias Grosser 8edce4ee62 Support SCoPs with multiple entry edges.
Regions that have multiple entry edges are very common. A simple if condition
yields e.g. such a region:

  if
 /   \
then  else
 \   /
for_region

This for_region contains two entry edges 'then' -> 'for_region' and 'else' -> 'for_region'.

Previously we scheduled the RegionSimplify pass to translate such regions into
simple regions. With this patch, we now support them natively when the region is
in -loop-simplify form, which means the entry block should not be a loop header.

Contributed by:  Star Tan <tanmx_star@yeah.net>

llvm-svn: 179586
2013-04-16 08:04:42 +00:00
Tobias Grosser d7e58640a5 Update formatting to latest version of clang-format
llvm-svn: 179160
2013-04-10 06:55:45 +00:00
Tobias Grosser 7670bb5c31 Cloog: Add virtual destructor to silence gcc warning
This silences the following warning:

  'polly::ClastVisitor' has virtual functions but non-virtual destructor
  [-Wnon-virtual-dtor]

llvm-svn: 177798
2013-03-23 01:10:53 +00:00