Commit Graph

713 Commits

Author SHA1 Message Date
Tobias Grosser 20bbbd30d2 Update CLooG such that the isl test cases are really up to date
llvm-svn: 184699
2013-06-24 07:38:29 +00:00
Tobias Grosser 04d6ae65b7 Fix my own formatting mistakes
llvm-svn: 184659
2013-06-23 06:04:54 +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
Sebastian Pop a189a5763c revert r183799: scop detection: remove an iteration over all uses
llvm-svn: 184128
2013-06-17 21:43:10 +00:00
Tobias Grosser c00bd98695 Update to a newer CLooG version
This update fixes the test cases to give correct results with the isl version
we are currently using.

llvm-svn: 184064
2013-06-16 19:55:07 +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
Sebastian Pop e1e4a2d534 scop detection: check flag before expensive call
llvm-svn: 184000
2013-06-14 20:20:39 +00:00
Tobias Grosser 3e030e178a Correctly convert APInt to gmp values
Previously this happend to work for integers up to i64, but we got it wrong
for larger numbers. Fix this and add test cases to verify this keeps working.

Reported by: Sven Verdoolaege <skimo at kotnet dot org>

llvm-svn: 183986
2013-06-14 16:23:38 +00:00
Tobias Grosser ef2ee4fec2 PoCC: Adjust to recent sys::Path removal
llvm-svn: 183969
2013-06-14 06:26:33 +00:00
Tobias Grosser aa76805796 Do not create an object to call a static function
llvm-svn: 183897
2013-06-13 09:10:23 +00:00
Sebastian Pop 9d63234ad1 ScopDetect: check region entering edges are valid.
When a region header is part of a loop, then all entering edges of this region
should not come from the loop but outside the region. Otherwise, the loop may be
only partially part of the region, which would cause troubles in handling
induction variables.

Currently, we can only model induction variables that are either fully part of
the scop (loop induction variable) or induction variables that are scop-
invariant (parameter). A loop that is only partially part of the
scop causes troubles, as there is no good way to handle the induction
variable in the independent blocks pass.

Contributed-by:    Star Tan <tanmx_star@yeah.net>
llvm-svn: 183800
2013-06-11 22:20:40 +00:00
Sebastian Pop 15117271c7 scop detection: remove an iteration over all uses
llvm-svn: 183799
2013-06-11 22:20:35 +00:00
Sebastian Pop b88ea5e991 scop detection: run isValidLoop as early as possible
to discard regions with invalid loops before going through the contents of the
basic blocks

llvm-svn: 183798
2013-06-11 22:20:32 +00:00
Sebastian Pop 9e3d2dd6ea scop detection: run isValidCFG as early as possible
to discard regions with invalid CFG before going through the contents of the
basic blocks

llvm-svn: 183797
2013-06-11 22:20:27 +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
Sebastian Pop b35892bd59 scop detection: do not call getAliasSetForPointer when IgnoreAliasing
Contributed-by: Dmitry N. Mikushin <maemarcus@gmail.com>
llvm-svn: 183114
2013-06-03 16:35:41 +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 26d1050da3 Update isl to include isl_val changes
The latest version of isl includes a new data type isl_val, which properly hides
the multi precision math library used by isl. In Polly we would like to replace
all uses of isl_int with the corresponding isl_val interfaces. This will allow
us to switch the multi precision math library in isl. This is especially
interesting for people who would like to replace libgmp with a non-gpl licensed
library (e.g. imath).

llvm-svn: 183026
2013-05-31 18:04:56 +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 14f802f99c include missing ISL header file
to be able to compile with ISL master as of today
1df91d8515ec88dc7f7f597168ad0f34f26de5a7

llvm-svn: 183023
2013-05-31 17:41:17 +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
Sebastian Pop 3d94fedf0b add comments to clarify the use of a temporary variable in the map insertion
llvm-svn: 182662
2013-05-24 18:46:02 +00:00
Sebastian Pop cbeb5e821f independent blocks: do not insert stores between phi nodes
llvm-svn: 182661
2013-05-24 18:45:58 +00:00
Sebastian Pop 753d43f974 fix insertion of values in BBMap
In GDB when "step" through generateScalarLoad and "finish" the call, the
returned value is non NULL, however when printing the value contained in
BBMap[Load] after this stmt:

  BBMap[Load] = generateScalarLoad(...);

the value in BBMap[Load] is NULL, and the BBMap.count(Load) is 1.

The only intuitive idea that I have to explain this behavior is that we are
playing with the undefined behavior of eval order of the params for the function
standing for "BBMap[Load] = generateScalarLoad()". "BBMap[Load] = " may be
executed before generateScalarLoad is called.

Here are some other possible explanations from Will Dietz <w@wdtz.org>:

The error is likely due to BBMap[Load] being evaluated first (creating
a {Load -> uninitialized } entry in the DenseMap), then
generateScalarLoad eventually accesses the same element and finds it
to be NULL (DenseMap[Old])..  Offhand I'm not sure if this is
guaranteed to be NULL or if it's uninitialized and happens to be NULL.

The same issue can also go wrong in an even worse way: the second
DenseMap access can trigger a rehash and *invalidate* the an earlier
evaluated expression (for example LHS of the assignment), leading to a
crash when performing the assignment store.

llvm-svn: 182655
2013-05-24 17:16:02 +00:00
Tobias Grosser 04be044af5 Remove .htaccess file
It was initially committed to allow people to get a list of the files used
or generated in the matmul tutorial. Since the documentation does now
point people to the directory in their git checkout, it is not necessary anymore
to make a directory listing available. Especially, as this never worked and
recently the LLVM web server does not deliver files in this directory at all
due to the unsupported .htaccess file.

llvm-svn: 182370
2013-05-21 11:58:47 +00:00
Sebastian Pop 359d3aa8a1 independent blocks: when moving Values, invalidate SCEV cached info
llvm-svn: 182310
2013-05-20 20:02:03 +00:00
Tobias Grosser 95935c5de1 Update matmul example to the latest polly version
As the namings of the scops have changed, polly was not able to read in the user
given .jscop files. By renaming the provided files, polly now finds them again
and can use them to optimize the matmul function. We also update the generated
files to reflect the very latest version of Polly.

llvm-svn: 182265
2013-05-20 14:01:54 +00:00
Sebastian Pop c90ec7812e rename make check target to match the naming convention followed in the other llvm projects
llvm-svn: 182171
2013-05-17 23:04:28 +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 83628182f7 Sort includes
llvm-svn: 181297
2013-05-07 08:11:54 +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 d0fe8371bf cmake: Add target to reformat with clang-format
Calling 'make polly-update-format' will format all Polly files with
clang-format.

llvm-svn: 181293
2013-05-07 07:30:31 +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 3ed2600cab SCEVValidator: Correctly store 'k * p' as a parameter
We do not only need to understand that 'k * p' is a parameter expression, but
also need to store this expression in the set of parameters. Before this patch
we wrongly stored the two individual parameters %k and %p.

Reported by: Sebastian Pop <spop@codeaurora.org>

llvm-svn: 179485
2013-04-14 13:15:59 +00:00
Tobias Grosser 249c4b1ad5 ScheduleOptimizer: Use isl_map_from_union_map to extract map.
llvm-svn: 179268
2013-04-11 05:55:13 +00:00
Tobias Grosser f242b806ac ScheduleOpt: Do not crash on statements with empty iteration domains
Statements with an empty iteration domain may not have a schedule assigned by
the isl schedule optimizer. As Polly expects each statement to have a schedule,
we keep the old schedule for such statements.

This fixes http://llvm.org/PR15645`

Reported-by: Johannes Doerfert  <johannesdoerfert@gmx.de>
llvm-svn: 179233
2013-04-10 22:48:08 +00:00
Sebastian Pop 1006614228 fix testcase
llvm-svn: 179183
2013-04-10 16:44:08 +00:00
Tobias Grosser ecb5092707 ScopDetect: Allow multiplications of the form <param> * <param>
We handle these by treating this result of the multiplication as an additional
parameter.

llvm-svn: 179163
2013-04-10 07:42:28 +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 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
Tobias Grosser 03fc9acbe5 Codegen: Replace region exit and entries recursively
During code generation we split the original entry and exit basic blocks
of the scop to make room for the newly generated code. To keep the region tree
up to date, we need to update the region tree. This patch ensures that not only
the region of the scop is updated, but also all child regions that share the
same entry or exit block.

We have now test case here, as the bug is only exposed by the subsequent commit.
The test cases of that commit also cover this bug.

Contributed-by: Star Tan <tanmx_star@yeah.net>
llvm-svn: 179158
2013-04-10 06:55:20 +00:00