Commit Graph

36 Commits

Author SHA1 Message Date
Sebastian Pop cd3bb59aa2 only delinearize when the access function is not affine
llvm-svn: 205971
2014-04-10 16:08:11 +00:00
Sebastian Pop 1801668af3 delinearize memory access functions
llvm-svn: 205799
2014-04-08 21:20:44 +00:00
Tobias Grosser e275e9216b Return conservative result in case the dependence check timed out
For complex examples it may happen that we do not compute dependences. In this
case we do not want to crash, but just not detect parallel loops.

llvm-svn: 204470
2014-03-21 15:12:09 +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
Rafael Espindola 80f20133d4 Fix polly tests to not include aliases to declarations.
llvm-svn: 203721
2014-03-12 21:48:42 +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 472d3b7037 codegen: Update LoopInfo correctly
Add the 'polly.start' basic block to the loop that surrounds the scop we just
codegenerate.

This fixes PR13441

llvm-svn: 202000
2014-02-24 00:50:49 +00:00
Tobias Grosser 88640d2b47 Use -polly-codegen-isl in isl-codegen test
Reported-by: Sebastian Pop <spop@codeaurora.org>
llvm-svn: 201902
2014-02-21 23:08:54 +00:00
Tobias Grosser 030237d0ff Codegen: Do not crash when seeing debug intrinsics
We now skip the debug intrinsics which is a lot better than crashing due to
uncopied metadata references. We should step by step investigate which debug
intrinsics we can copy without trouble.

We still keep the debug location metadata.

llvm-svn: 201860
2014-02-21 15:06:05 +00:00
Tobias Grosser 54646f7fab Remove other unneccessary uses of -O3 in the test suite
The polly test suite is now -O3 clean.

llvm-svn: 200205
2014-01-27 10:37:06 +00:00
Tobias Grosser a7fea8386c Do not run -O3 to canonicalize test case
This is not only not necessary, but in case -03 changes this can actually
cause arbitrarily failing test cases such as, e.g., a recent change by Chandler
that caused -O3 to unroll the loop body, which made the loop we wanted to
detect disappear and consequently this test case fail.

llvm-svn: 200204
2014-01-27 10:23:12 +00:00
Tobias Grosser 54ee0ba74d IslCodegen: Support for run-time conditions
llvm-svn: 194948
2013-11-17 03:18:25 +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
Sebastian Pop 20594a842c use -polly-codegen-isl in tests under test/Isl
llvm-svn: 192110
2013-10-07 16:43:04 +00:00
Tobias Grosser 3613fd7a35 ScopInfo: Correctly handle true/false conditions
This is a modified version of the orignally contributed patch.

Contributed-by: alexandre.isoard@gmail.com
llvm-svn: 190237
2013-09-07 01:54:13 +00:00
Sebastian Pop 2c9ec2e651 scop detection: do not run scop detection on regions without loops
otherwise, use -polly-detect-scops-in-regions-without-loops to also detect scops
in regions without loops

llvm-svn: 183113
2013-06-03 16:35:37 +00:00
Tobias Grosser 93324aef17 Test that independent block pass does not transform induction variables
The original test case showed a problem with the independet blocks pass and
we decided to XFAIL it for now. Unfortunately the failure is not detected if
we build without asserts and the verification of the independent block pass
is not run. This change tests now for the actual reason of the failure and
should trigger even in a non asserts build. We did not yet solve the underlying
bug, but this should at least make the test suite behavior consistent.

llvm-svn: 183025
2013-05-31 17:44:38 +00:00
Sebastian Pop 8fe6d11b84 scop detection: only handle functions with loops
to detect scops in functions with no loops, use -polly-detect-scops-in-functions-without-loops

llvm-svn: 182941
2013-05-30 17:47:32 +00:00
Tobias Grosser 3081b0f5ec Update LoopInfo correctly
When the Polly code generation was written we did not correctly update the
LoopInfo data, but still claimed that the loop information is correct. This
does not only lead to missed optimizations, but it can also cause
miscompilations in case passes such as LoopSimplify are run after Polly.

Reported-by: Sergei Larin <slarin@codeaurora.org>
llvm-svn: 181987
2013-05-16 06:40:24 +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 e8df5bd92b IndependentBlocks: We can only reconstruct PHI nodes that are within the ScoP
In the classical (non -polly-codegen-scev) mode, we assume that we can always
recreate PHI nodes during code generation. This is not true. We can only
reconstruct them from the polyhedral information, in case the entire loop of the
PHI node is part of the SCoP and consequently the PHI node was translated in
the polyhedral description.

llvm-svn: 179674
2013-04-17 07:20:36 +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 36a01b0a28 tests: Fix 'instruction does not dominate all its uses' error
The LLVM-IR of this test case was apperently incorrect.

llvm-svn: 179672
2013-04-17 07:20:17 +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 0ee50f6ee4 Support SCoPs with multiple exit edges
Regions that have multiple exit edges are very common. A simple if condition
yields e.g. such a region:

        if
      /   \
  then     else
      \   /
      after

Region: if -> after

This regions contains the bbs 'if', 'then', 'else', but not 'after'. It has
two exit edges 'then' -> 'after' and 'else' -> 'after'.

Previously we scheduled the RegionSimplify pass to translate such regions into
simple regions. With this patch, we now support them natively.

Contributed-by: Star Tan <tanmx_star@yeah.net>
llvm-svn: 179159
2013-04-10 06:55:31 +00:00
Sebastian Pop 9ca6612731 IndependentBlocks: translate out of SSA all uses escaping the region
llvm-svn: 179019
2013-04-08 13:05:41 +00:00
Tobias Grosser 369430ffca codegen: properly instantiate SCEVs to the place where they are used
Given the following code

    for (i = 0; i < 10; i++) {
      ;
    }

S:  A[i] = 0

When code generating S using scev based code generation, we need to retrieve
the scev of 'i' at the location of 'S'. If we do not do this the scev that
we obtain will be expressed as {0,+,1}_for and will reference loop iterators
that do not surround 'S' and that we consequently do not know how to code
generate. What we really want is the scev to be instantiated to the value of 'i'
after the loop. This value is {10} and it can be code generated without
troubles.

llvm-svn: 177777
2013-03-22 23:42:53 +00:00
Tobias Grosser 8ff029ccf1 Add failing test case
llvm-svn: 177645
2013-03-21 16:14:55 +00:00
Sebastian Pop 97cb813c29 Correct function to decide if a SCEV can be ignored
When doing SCEV based code generation, we ignore instructions calculating values
that are fully defined by a SCEV expression. The values that are calculated by
this instructions are recalculated on demand.

This commit improves the check to verify if certain instructions can be ignored
and recalculated on demand.

llvm-svn: 177313
2013-03-18 20:21:13 +00:00
Bill Wendling 83e9312ece Use attributes references on call/invoke instructions.
llvm-svn: 175881
2013-02-22 09:29:15 +00:00
Tobias Grosser c92c8f06ec [isl-codegen]: Fix off by one in getNumberOfIterations
We need to remove one dimension. Any is correct as long as it exists. We have
choosen for whatever reason the dimension #dims - 2. This is incorrect if
there is just one dimension. For CLooG this case did never happen. For isl
however, the case can happen and causes undefined behavior including crashes.
We choose now always the last dimension #dims - 1. We could have choosen
dimension '0' but the last dimension is what we remove conceptionally in the
algorithm, so it seems better to actually program it that way.

While at it remove another piece of undefined behavior.

llvm-svn: 174894
2013-02-11 17:52:36 +00:00
Sebastian Pop 04c4ce32ae isl: vector code generation based on ISL ast
Original patch by Tobias Grosser, slightly modified by Sebastian Pop.

llvm-svn: 170420
2012-12-18 07:46:13 +00:00
Sebastian Pop e252c85545 isl: detect vector parallelism
llvm-svn: 170138
2012-12-13 16:52:41 +00:00
Tobias Grosser e36abf6d5d isl: Detect openmp parallelism
Based on code written by Riyadh Baghdadi.

llvm-svn: 170102
2012-12-13 06:24:06 +00:00
Sebastian Pop a267d9b829 adapt cloog codegen testcases to isl
llvm-svn: 169161
2012-12-03 21:34:09 +00:00
Sebastian Pop b08a52898a execute cloog specific testcases only with CLOOG_FOUND
llvm-svn: 169159
2012-12-03 21:33:40 +00:00