Commit Graph

1958 Commits

Author SHA1 Message Date
Johannes Doerfert f363bfb730 [FIX] Typo
llvm-svn: 244733
2015-08-12 10:45:20 +00:00
Johannes Doerfert 916736ef73 Expose the SCEVAffinator and make it a member of a SCoP (cont'd)
Added missing documentation and linked to the correct revision.

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

llvm-svn: 244731
2015-08-12 10:28:45 +00:00
Johannes Doerfert 574182d394 Expose the SCEVAffinator and make it a member of a SCoP.
This change has three major advantages:
    - The ScopInfo becomes smaller.
    - It allows to use the SCEVAffinator from outside the ScopInfo.
    - A member object allows state which in turn allows e.g., caching.

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

llvm-svn: 244730
2015-08-12 10:19:50 +00:00
Johannes Doerfert 9e0daff91e Make arc unit work with ninja builds
In order to find the llvm-obj directory it has to be (or a soft link
  to it) at one of the following locations:

    ${POLLY_SRC_DIR}/build
    ${POLLY_SRC_DIR}.build
    ${POLLY_SRC_DIR}-build
    s/${POLLY_SRC_DIR}/src/build

  Alternatively, the environment variable $POLLY_BIN_DIR can point to it.

llvm-svn: 244727
2015-08-12 09:02:20 +00:00
Johannes Doerfert a7ba98caa2 Adjusted arc linter config for modern version of arcanist
llvm-svn: 244726
2015-08-12 09:01:16 +00:00
Tobias Grosser a77cea49d1 Always model PHI nodes in scop (if not in same nonaffine subregion)
Before we only modeled PHI nodes if at least one incoming basic block was itself
part of the region, now we always model them except if all of their operands are
part of a single non-affine subregion which we model as a black-box.

This change only affects PHI nodes in the entry block, that have exactly one
incoming edge. Before this change, we did not model them and as a result code
generation would not know how to code generate them. With this change, code
generation can code generate them like any other PHI node.

This issue was exposed by r244606. Before this change simplifyRegion would have
moved these PHI nodes out of the SCoP, so we would never have tried to code
generate them. We could implement this behavior again, but changing the IR
after the scop has been modeled and transformed always adds a risk of us
invalidating earlier analysis results. It seems more save and overall also more
consistent to just model and handle this one-entry-edge PHI nodes like any
other PHI node in the scop.

Solution proposed by:  Michael Kruse  <llvm@meinersbur.de>

llvm-svn: 244721
2015-08-12 07:48:54 +00:00
Michael Kruse fba24b3775 Add another test case with trival PHI in entry BB
This one was extracted from the test-suite's pifft and caused a
miscompilation because a scalar was not written to its alloca address.

llvm-svn: 244720
2015-08-12 07:34:55 +00:00
Michael Kruse 4f9caf2b28 Add test case for entry node with trivial PHI
This is a break-down from the test-suite's oggenc where Polly currently
crashes. 

llvm-svn: 244692
2015-08-11 23:09:19 +00:00
Michael Kruse 9c483c5834 Assign regions to all BBs from CodeGeneration
In order to have a valid region analysis, we assign all newly created blocks to the parent of the scop's region. This is correct for any pre-existing regions (including the scop's region and its parent), but does not discover any region inside the generated code. For Polly this is not necessary because we do not want to re-run Polly on its own generated code anyway.

Reviewers: grosser

Part of Differential Revision: http://reviews.llvm.org/D11867

llvm-svn: 244608
2015-08-11 14:47:37 +00:00
Michael Kruse 22370884c4 Revise the simplification of regions
The previous code had several problems:

For newly created BasicBlocks it did not (always) call RegionInfo::setRegionFor in order to update its analysis. At the moment RegionInfo does not verify its BBMap, but will in the future. This is fixed by determining the region new BBs belong to and set it accordingly. The new executeScopConditionally() requires accurate getRegionFor information. 

Which block is created by SplitEdge depends on the incoming and outgoing edges of the blocks it connects, which makes handling its output more difficult than it needs to be. Especially for finding which block has been created an to assign a region to it for the setRegionFor problem above. This patch uses an implementation for splitEdge that always creates a block between the predecessor and successor. simplifyRegion has also been simplified by using SplitBlockPredecessors instead of SplitEdge. Isolating the entries and exits have been refectored into individual functions.

Previously simplifyRegion did more than just ensuring that there is only one entering and one exiting edge. It ensured that the entering block had no other outgoing edge which was necessary for executeScopConditionally(). Now the latter uses the alternative splitEdge implementation which can handle this situation so simplifyRegion really only needs to simplify the region.

Also, executeScopConditionally assumed that there can be no PHI nodes in blocks with one incoming edge. This is wrong and LCSSA deliberately produces such edges. However, previous passes ensured that there can be no such PHIs in exit nodes, but which will no longer hold in the future.

The new code that the property that it preserves the identity of region block (the property that the memory address of the BasicBlock containing the instructions remains the same; new blocks only contain PHI nodes and a terminator), especially the entry block. As a result, there is no need to update the reference to the BasicBlock of ScopStmt that contain its instructions because they have been moved to other basic blocks.

Reviewers: grosser

Part of Differential Revision: http://reviews.llvm.org/D11867 

llvm-svn: 244606
2015-08-11 14:39:21 +00:00
Michael Kruse 23d0e83aa3 Introduce splitBlock and use it in splitEntryBlockForAlloca
RegionInfo::splitBlock did not update RegionInfo correctly. Specifically, it tried to make the new block the entry block if possible. This breaks for nested regions that have edges to the old block. 

We simply do not change the entry block. Updating RegionInfo becomes trivial as both block will always be in the same region.

splitEntryBlockForAlloca makes use of the new splitBlock.

Reviewers: grosser

Part of Differential Revision: http://reviews.llvm.org/D11867

llvm-svn: 244600
2015-08-11 14:04:06 +00:00
Tobias Grosser 6e3ba33b07 Update isl to isl-0.15-117-ge42acfe
Besides other changes this version of isl contains a fundamental fix to memory
corruption issues we have seen with imath-32 backed isl_ints.

This update also contains a fix that ensures that the schedule-tree based
version of isl's dependence analysis takes the domain of the schedule into
account.

llvm-svn: 244585
2015-08-11 11:31:18 +00:00
Tobias Grosser c186ac7aea BlockGenerator: Do not store 'store' statements in BBMap
A store statement has no return value and can consequently not be referenced
from another statement.

llvm-svn: 244576
2015-08-11 08:13:15 +00:00
Michael Kruse 874b5c2197 Correct non-existing past participle of split in filename
llvm-svn: 244478
2015-08-10 18:37:34 +00:00
Johannes Doerfert d6c30160e7 Make StmtSet a list.
With a deque (or any other sequential container) it is not sound to
  take the address of the elements when the container is still under
  construction. With a pointer based container this is save.

llvm-svn: 244459
2015-08-10 16:47:20 +00:00
Michael Kruse 4adb0279a8 Add test case with PHI node in exit block
The PHI node with multiple incoming edges from inside the region.

Thanks Tobias for coming up with the example. 

llvm-svn: 244456
2015-08-10 16:17:59 +00:00
Michael Kruse 1d3c9b54fb Remove leftover comment
The function to which this commit applies has been removed in a
previous commit.

llvm-svn: 244450
2015-08-10 15:07:16 +00:00
Michael Kruse 046dde40c5 [Polly] Refactor buildScop
Summary: The extracted function buildBBScopStmt will be needed later to be invoked individually on the region's exit block.

Reviewers: grosser, jdoerfert

Subscribers: jdoerfert, llvm-commits, pollydev

Projects: #polly

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

llvm-svn: 244443
2015-08-10 13:01:57 +00:00
Michael Kruse fd613545cb [Polly] Remove dead code in IndependentBlocks
Summary: The splitExitBlock function is never called. Going to replace its functionality in successive patches that do not modify the IR.

Reviewers: grosser

Subscribers: pollydev

Projects: #polly

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

llvm-svn: 244404
2015-08-08 20:31:20 +00:00
Michael Kruse 9bb8ef03a2 Add an assertion
Check whether a block is a direct predecessor.

llvm-svn: 244401
2015-08-08 18:10:54 +00:00
Michael Kruse 27aae88d76 Do not use -fvisibility option with Visual C
It doesn't know the option and prints a warning. 

llvm-svn: 244363
2015-08-07 22:16:44 +00:00
Tanya Lattner 62dba3b7b6 Update links to lists.llvm.org.
llvm-svn: 244009
2015-08-05 04:19:04 +00:00
Tobias Grosser dcc3b435ab Optionally model read-only scalars
Even though read-only accesses to scalars outside of a scop do not need to be
modeled to derive valid transformations or to generate valid sequential code,
but information about them is useful when we considering memory footprint
analysis and/or kernel offloading.

llvm-svn: 243981
2015-08-04 13:54:20 +00:00
Tobias Grosser fbe7a2e841 Run ScopInfo after the ScopViewers
This change is required to see the detected scops even in cases where there is
no other ScopInfo user after the ScopViewers. Before this change, when
running with -polly-optimizer=none -polly-code-generator=none detected scops
have not been shown.

llvm-svn: 243971
2015-08-04 11:49:39 +00:00
Tobias Grosser ac3a95f347 Do not add spaces into memory-access identifiers
llvm-svn: 243889
2015-08-03 17:53:21 +00:00
Duncan P. N. Exon Smith 20b50f2b2a Update testcases after LLVM r243885
llvm-svn: 243887
2015-08-03 17:28:43 +00:00
Tobias Grosser 14e67e43a7 Add option -polly-view-only
If set, this option instructs -view-scops and -polly-show to only print
functions that contain the specified string in their name. This allows to
look at the scops of a specific function in a large .ll file, without flooding
the screen with .dot graphs.

llvm-svn: 243882
2015-08-03 16:39:56 +00:00
Tobias Grosser 6213913244 Use the branch instruction to define the location of a PHI-node write
We use the branch instruction as the location at which a PHI-node write takes
place, instead of the PHI-node itself. This allows us to identify the
basic-block in a region statement which is on the incoming edge of the PHI-node
and for which the write access was originally introduced. As a result we can,
during code generation, avoid generating PHI-node write accesses for basic
blocks that do not preceed the PHI node without having to look at the IR
again.

This change fixes a bug which was introduced in r243420, when we started to
explicitly model PHI-node reads and writes, but dropped some additional checks
that where still necessary during code generation to not emit PHI-node writes
for basic-blocks that are not on incoming edges of the original PHI node.
Compared to the code before r243420 the new code does not need to inspect the IR
any more and we also do not generate multiple redundant writes.

llvm-svn: 243852
2015-08-02 16:17:41 +00:00
Tobias Grosser d2d15a8c65 Dependences: Zero pad the schedule map
The schedule map we derive from a schedule tree map may map statements into
schedule spaces of different dimensionality. This change adds zero padding
to ensure just a single schedule space is used and the translation from
a union_map to an isl_multi_union_pw_aff does not fail.

llvm-svn: 243849
2015-08-02 13:30:33 +00:00
Tobias Grosser 45e7944bcf Only use instructions as insert locations for SCEVExpander
SCEVExpander, which we are using during code generation, only allows
instructions as insert locations, but breaks in case BasicBlock->end() iterators
are passed to it due to it trying to obtain the basic block in which code should
be generated by calling Instruction->getParent(), which is not defined for
->end() iterators.

This change adds an assert to Polly that ensures we only pass valid instructions
to SCEVExpander and it fixes one case, where we used IRBuilder->SetInsertBlock()
to set an ->end() insert location which was later passed to SCEVExpander.

In general, Polly is always trying to build up the CFG first, before we actually
insert instructions into the CFG sceleton. As a result, each basic block should
already have at least one branch instruction before we start adding code. Hence,
always requiring the IRBuilder insert location to be set to a real instruction
should always be possible.

Thanks Utpal Bora <cs14mtech11017@iith.ac.in> for his help with test case
reduction.

llvm-svn: 243830
2015-08-01 09:07:57 +00:00
Tobias Grosser d3f21833b9 Fix typo
llvm-svn: 243829
2015-08-01 06:26:51 +00:00
Duncan P. N. Exon Smith c51714a0c6 Fix polly tests after LLVM IR change in r243774
llvm-svn: 243801
2015-07-31 23:58:50 +00:00
Michael Kruse 471a5e3388 Move computations out of constructors
It is common practice to keep constructors lightweight. The reasons
include:

- The vtable during the constructor's execution is set to the static
type of the object, not to the vtable of the derived class. That is,
method calls behave differently in constructors and ordinary methods.
This way it is possible to call unimplemented methods of abstract
classes, which usually results in a segmentation fault.

- If an exception is thrown in the constructor, the destructor is not
called, potentially leaking memory.

- Code in constructors cannot be called in a regular way, e.g. from
non-constructor methods of derived classes.

- Because it is common practice, people may not expect the constructor
to do more than initializing data and skip them when looking for bugs.

Not all of these are applicable to LLVM (e.g. exceptions are disabled).

This patch refactors out the computational work in the constructors of
Scop and IslAst into regular init functions and introduces static
create-functions as replacement. 

Differential revision: http://reviews.llvm.org/D11491

Reviewers: grosser, jdoerfert
llvm-svn: 243677
2015-07-30 19:27:04 +00:00
Tobias Grosser 80e237bd53 Do not detect scops that are delinearized to arrays with "undef" size
Such codes are not interesting to optimize and most likely never appear in the
normal compilation flow. However, they show up during test case reduction with
bugpoint and trigger -- without this change -- an assert in
polly::MemoryAccess::foldAccess(). It is better to detect them in
ScopDetection itself and just bail out.

Contributed-by:  Utpal Bora  <cs14mtech11017@iith.ac.in>

Reviewers: grosser

Subscribers: pollydev, llvm-commits

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

llvm-svn: 243515
2015-07-29 13:52:05 +00:00
Tobias Grosser d20aba7047 Remove some dead code
llvm-svn: 243465
2015-07-28 19:16:46 +00:00
Tobias Grosser 2be13913bb Do not end lines with '\'
This fixes 'warning: multi-line comment [-Wcomment]'

llvm-svn: 243464
2015-07-28 19:16:42 +00:00
Tobias Grosser b241d928bd Rewrite getPrevectorMap using schedule trees operations
Schedule trees are a lot easier to work with, for both humans and machines. For
humans the more structured schedule representation is easier to reason about.
Together with the more abstract isl programming interface this can result in a
lot cleaner code (see this changeset). For machines, the structured schedule and
the fact that we now use explicit piecewise affine expressions instead of
integer maps makes it easier to generate code from this schedule tree. As a
result, we can already see a slight compile-time improvement -- for 3mm from
0m0.593s to 0m0.551s seconds (-7 %). More importantly, future optimizations such
as full-partial tile separation will most likely result in more streamlined code
to be generated.

Contributed-by: Roman Gareev <gareevroman@gmail.com>
llvm-svn: 243458
2015-07-28 18:03:36 +00:00
Tobias Grosser 922452285a Keep track of ScopArrayInfo objects that model PHI node storage
Summary:
When translating PHI nodes into memory dependences during code generation we
require two kinds of memory. 'Normal memory' as for all scalar dependences and
'PHI node memory' to store the incoming values of the PHI node. With this
patch we now mark and track these two kinds of memories, which we previously
incorrectly marked as a single memory object.

Being aware of PHI node storage makes code generation easier, as we do not need
to guess what kind of storage a scalar reference requires. This simplifies the
code nicely.

Reviewers: jdoerfert

Subscribers: pollydev, llvm-commits

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

llvm-svn: 243420
2015-07-28 14:53:44 +00:00
Tobias Grosser 9696a3f903 Do not compile GPU library with sanitizers
llvm-svn: 243411
2015-07-28 12:51:23 +00:00
Tobias Grosser 43bf4553fd Extend documentation of scalar code generation [NFC]
No functional change intended

--
Reviewers: jdoerfert

Projects: #polly

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

llvm-svn: 243410
2015-07-28 12:12:04 +00:00
Tobias Grosser d4dd6ec74d Simplify code in BlockGenerator::generateScalarLoads [NFC]
We hoist statements that are used on both branches of an if-condition, shorten
and unify some variable names and fold some variable declarations into their
only uses. We also drop a comment which just describes the elements the loop
iterates over.

No functional change intended.

llvm-svn: 243291
2015-07-27 17:57:58 +00:00
Tobias Grosser 2764794ba4 Simplify some isl expression we use
Suggested-by: Sven Verdoolaege <skimo-polly@kotnet.org>
llvm-svn: 243254
2015-07-26 19:22:35 +00:00
Johannes Doerfert 210b09aa21 Remove explicit heap allocation to fix and prevent memory leaks
llvm-svn: 243245
2015-07-26 13:14:38 +00:00
Tobias Grosser bb853c24b1 Fix formatting of recent alias-analysis commit
llvm-svn: 243215
2015-07-25 12:31:03 +00:00
Tobias Grosser 3b10c94062 Prevectorize the schedule of the band (or the point loop in case of tiling)
Contributed-by: Roman Gareev <gareevroman@gmail.com>
llvm-svn: 243214
2015-07-25 12:28:56 +00:00
Michael Kruse be16d22f04 Normalize whitespace in makefiles
Tabs for rules and space for line continuations.

llvm-svn: 243179
2015-07-24 23:30:31 +00:00
Michael Kruse 392417808d Add isl_ffs.c to file list in autoconf builds
In most configurations it doesn't contain any symbol, but add for
completeness.

llvm-svn: 243168
2015-07-24 21:40:22 +00:00
Michael Kruse 1bbe346cef Make the lit configuration Python 3 compatible
by using the same techniques as LLVM's lit configuration.

llvm-svn: 243154
2015-07-24 20:33:22 +00:00
Michael Kruse d3059f3853 Compile fix; add missing ISL files
The last ISL update added two files that we must also add to Polly. 

llvm-svn: 243142
2015-07-24 19:09:27 +00:00
Tobias Grosser 566060d76f Update isl to isl-0.15-86-g595055e
Besides a couple of cleanups and refactorings in isl, this change set fixes a
couple of bugs in isl, that can cause issues during code generation.

llvm-svn: 243110
2015-07-24 13:12:17 +00:00
Michael Kruse 5e9f249c3e Add LICM test cases
These test cases check whether Polly still gives the same results if
LICM runs before.  Currently, it does not and therefore these cases are
expected fails. 

llvm-svn: 243037
2015-07-23 20:05:11 +00:00
Michael Kruse 75b6b0c5bd Always execute polly::CodePreparation before Polly
ScopDetection does not allow scops to begin with the entry block, were
allocas are added at code generation.

llvm-svn: 243036
2015-07-23 20:00:20 +00:00
Johannes Doerfert 338b42c329 Removed redundant alias checks generated during run time.
As specified in PR23888, run-time alias check generation is expensive
  in terms of compile-time. This reduces the compile time by computing
  minimal/maximal access only once for each base pointer

Contributed-by: Pratik Bhatu <cs12b1010@iith.ac.in>
llvm-svn: 243024
2015-07-23 17:04:54 +00:00
Tobias Grosser 6d32f8fbba isl: Translate brisebarre to use UNIX line endings
A similar patch will be upstreamed to ISL. We commit this ahead of time to
unblock people that are annoyed the permanent diffs we see in git.

llvm-svn: 243020
2015-07-23 15:35:45 +00:00
Chandler Carruth e677f7217b [PM/AA] Update to reflect the new LLVM API which no longer requires an
AliasAnalysis pointer.

llvm-svn: 242897
2015-07-22 12:15:33 +00:00
Michael Kruse bc776a7069 Update ISL to isl-0.15-61-gcea776f
The motivation is to fix a wrong use of the inline qualifier. This
fixes the Polly build using Visual Studio 2015 RC.

llvm-svn: 242780
2015-07-21 12:56:36 +00:00
Michael Kruse 6362f5aa0b Unify FOLDER property of Polly targets
Put all Polly targets into a single "Polly" category (i.e.
solution folder). Previously there was no recognizable scheme and most
categories contained just one or two targets or targets didn't belong
to any category.

Reviewers: grosser
llvm-svn: 242779
2015-07-21 12:40:01 +00:00
Michael Kruse 9e0db1d2e8 Remove header project from Visual Studio builds
Remove the polly_headers_do_not_build project. Visual Studio is capable
of finding the headers itself, although they are not listed explicitly.
For explicit listing, the headers should be added to the relevant
target.

Reviewers: grosser
llvm-svn: 242777
2015-07-21 12:33:15 +00:00
Michael Kruse c4ad882daf Remove module LLVMPolly from Windows build
Loadable modules are not supported on Windows.

Reviewers: grosser
llvm-svn: 242776
2015-07-21 12:29:02 +00:00
Michael Kruse 441357dca2 Remove gcc-specific flags from Visual Studio build
Remove the flags -fno-exceptions -fno-rtti and add the equivalent for
compiling with MSVC.

Reviewers: grosser
llvm-svn: 242775
2015-07-21 12:22:36 +00:00
Michael Kruse 99f2db166b Remove /Za flag from Visual Studio compilation
According to Stephan T. Lavavej it is broken. See
http://comments.gmane.org/gmane.comp.compilers.clang.devel/21638

Reviewers: grosser
llvm-svn: 242773
2015-07-21 12:16:00 +00:00
Michael Kruse 9e44f2f1cc Add a test for stdint.h like ISL's configure does
Reviewers: grosser
llvm-svn: 242772
2015-07-21 12:09:41 +00:00
Michael Kruse d2bb9a3a31 Remove gitconfig.h.cmake
It is just one line which can be better generated in the CMakeLists.txt
itself, just as ISL's configure does.

Reviewers: grosser
llvm-svn: 242771
2015-07-21 12:06:27 +00:00
Michael Kruse bf5a711e96 Add configure-time test for latest ISL
Query the isl_config.h macros recently added to ISL. One of it looks for
the ffs (find first set), whose functionality is available in Visual
Studio with _BitScanForward. Also add isl_ffs.c to the source files
which contains the implementation of ffs using _BitScanForward.

Reviewers: grosser
llvm-svn: 242770
2015-07-21 12:01:14 +00:00
Tobias Grosser 495124c4d6 GPURuntimeDebugPrinter: Printer pointer values (except if they are strings)
Only pointer values in constant address space are assumed to be strings. For
all other pointers their address is printed.

llvm-svn: 242524
2015-07-17 13:57:57 +00:00
Tobias Grosser d783a98303 Add option to choose where in the pass pipeline polly is run
These options are useful to play with the location of Polly within LLVM's
pass manager.

llvm-svn: 242390
2015-07-16 08:28:09 +00:00
Tobias Grosser 469609a714 Mark a couple of items as completed
llvm-svn: 242136
2015-07-14 10:52:58 +00:00
Tobias Grosser c268835eca Drop outdated video
llvm-svn: 242135
2015-07-14 10:45:03 +00:00
Tobias Grosser 0241bd2c7e www: Add link to llvm.org
llvm-svn: 242134
2015-07-14 10:44:06 +00:00
Tobias Grosser 808cd69a92 Use schedule trees to represent execution order of statements
Instead of flat schedules, we now use so-called schedule trees to represent the
execution order of the statements in a SCoP. Schedule trees make it a lot easier
to analyze, understand and modify properties of a schedule, as specific nodes
in the tree can be choosen and possibly replaced.

This patch does not yet fully move our DependenceInfo pass to schedule trees,
as some additional performance analysis is needed here. (In general schedule
trees should be faster in compile-time, as the more structured representation
is generally easier to analyze and work with). We also can not yet perform the
reduction analysis on schedule trees.

For more information regarding schedule trees, please see Section 6 of
https://lirias.kuleuven.be/handle/123456789/497238

llvm-svn: 242130
2015-07-14 09:33:13 +00:00
Tobias Grosser 16c4403a91 Make non-affine statement names isl compatible
Named isl sets can generally have any name if they remain within Polly, but only
certain strings can be parsed by isl. The new names we create ensure that we
can always copy-past isl strings from Polly to other isl tools, e.g. for
debugging.

llvm-svn: 241787
2015-07-09 07:31:45 +00:00
Tobias Grosser ec46e5376d Print thread-identifiers in GPU debug output
This helps us to understand which thread prints which information.

llvm-svn: 241452
2015-07-06 15:36:16 +00:00
Tobias Grosser 6c78048b76 Update isl to isl-0.15-35-ga1e44f0
This fixes a memory leak with in the sioimath backend.

llvm-svn: 241247
2015-07-02 07:59:21 +00:00
Tobias Grosser f519a288d5 Remove versions from README and add update instructions
llvm-svn: 241246
2015-07-02 07:59:16 +00:00
Tobias Grosser 4db553199c Update isl to isl-0.15-30-g3518765
This updated contains various changes to isl, including improvements to the
AST generator. For Polly, the most important change is a fix that unbreaks
builds on darwin (reported by: Jack Howard)

llvm-svn: 241048
2015-06-30 08:22:14 +00:00
Michael Kruse acc9ad5991 [Polly] Add -std=c99 flag only to C source files
Summary: Adding the flag to C++ source files emits a warning, hence we set the compile flag depending on the file's language.

Reviewers: grosser

Subscribers: Meinersbur, pollydev, llvm-commits

Projects: #polly

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

llvm-svn: 240986
2015-06-29 19:57:59 +00:00
Tobias Grosser 1b13ddea50 Add first support to delinearize A[t%2][i][j]
This is very preliminary support, but it seems to work for the most common case.
When observing more/different test cases, we can work on generalizing this.

llvm-svn: 240955
2015-06-29 14:44:22 +00:00
Tobias Grosser 23bceb2eec Fix delinearization after it's move to ScalarEvoltion
llvm-svn: 240954
2015-06-29 14:44:17 +00:00
Tobias Grosser 1a07e19180 Increase the dependence-analysis compute out
As Polly got a lot faster after the small-integer-optimization imath
patch, we now increase the compute out to optimize larger kernels. This
should also expose additional slow-downs for us to address.

In LNT this gives us a 3.4x speedup on 3mm, at a cost of a 2x increase in
compile time (now 0.77s). reg_detect, oorafft and adi also show some compile
time increases. This compile time cost is divided between more time in isl and
more time in LLVM's backends due to increased code size (versioning and tiling).

llvm-svn: 240840
2015-06-26 21:58:42 +00:00
Tobias Grosser f54bb7743a Drop divs before adding array-out-of-bounds assumptions
In case we have modulo operations in the access function (supported since
r240518), the assumptions generated to ensure array accesses remain within
bounds can contain existentially quantified dimensions which results in more
complex and more difficult to handle integer sets. As a result LNT's linpack
benchmark started to fail due to excessive compile time.

We now just drop the existentially quantified dimensions. This should be
generally save, but may result in less precise assumptions which may
consequently make us fall back to the original (unoptimized) code more often. In
practice, these cases probably do not appear to often.

I had difficulties to extract a good test case, but fortunately our LNT bots
cover this one well.

llvm-svn: 240775
2015-06-26 12:09:28 +00:00
Tobias Grosser af4e809ca6 Remove code for scalar and PHI to array translation
This removes old code that has been disabled since several weeks and was hidden
behind the flags -disable-polly-intra-scop-scalar-to-array=false and
-polly-model-phi-nodes=false. Earlier, Polly used to translate scalars and
PHI nodes to single element arrays, as this avoided the need for their special
handling in Polly. With Johannes' patches adding native support for such scalar
references to Polly, this code is not needed any more. After this commit both
-polly-prepare and -polly-independent are now mostly no-ops. Only a couple of
simple transformations still remain, but they are scheduled for removal too.

Thanks again to Johannes Doerfert for his nice work in making all this code
obsolete.

llvm-svn: 240766
2015-06-26 07:31:18 +00:00
Michael Kruse f1ac0fcf56 Enable ISL's small integer optimization
Summary:
With small integer optimization (short: sio) enabled, ISL uses 32 bit
integers for its arithmetic and only falls back to a big integer library
(in the case of Polly: IMath) if an operation's result is too large.
This gives a massive performance boost for most application using ISL.
For instance, experiments with ppcg (polyhedral source-to-source
compiler) show speed-ups of 5.8 (compared to plain IMath), respectively
2.7 (compared to GMP).

In Polly, a smaller fraction of the total compile time is taken by ISL,
but the speed-ups are still very significant. The buildbots measure
compilation speed-up up to 1.8 (oourafft, floyd-warshall, symm). All
Polybench benchmarks compile in at least 9% less time, and about 20%
less on average.

Detailed Polybench compile time results (median of 10):
correlation     -25.51%
covariance      -24.82%
2mm             -26.64%
3mm             -28.69%
atax            -13.70%
bicg            -10.78%
cholesky        -40.67%
doitgen         -11.60%
gemm            -11.54%
gemver          -10.63%
gesummv         -11.54%
mvt              -9.43%
symm            -41.25%
syr2k           -14.71%
syrk            -14.52%
trisolv         -17.65%
trmm             -9.78%
durbin          -19.32%
dynprog          -9.09%
gramschmidt     -15.38%
lu              -21.77%
floyd-warshall  -42.71%
reg_detect      -41.17%
adi             -36.69%
fdtd-2d         -32.61%
fdtd-apml       -21.90%
jacobi-1d-imper  -9.41%
jacobi-2d-imper -27.65%
seidel-2d       -31.00%

Reviewers: grosser

Reviewed By: grosser

Subscribers: Meinersbur, llvm-commits, pollydev

Projects: #polly

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

llvm-svn: 240689
2015-06-25 20:47:35 +00:00
Michael Kruse dddfeb6992 Fix autotools build
There were two issues:
* ISL's configure generates include/isl/stdint.h, not isl/stdint.h as
  assumed. This is also changed in the CMake build.

* Need to pass --with-int=imath to ISL's configure; the default is gmp. 

Polly's configure has been regenerated due to changing configure.ac

llvm-svn: 240657
2015-06-25 16:50:13 +00:00
Tobias Grosser 50165ffdee Add support for srem instruction
Remainder operations with constant divisor can be modeled as quasi-affine
expression. This patch adds support for detecting and modeling them. We also
add a test that ensures they are correctly code generated.

This patch was extracted from a larger patch contributed by Johannes Doerfert
in http://reviews.llvm.org/D5293

llvm-svn: 240518
2015-06-24 04:13:29 +00:00
Tobias Grosser a608569856 Replace srem by function call in nonaffine test cases
This makes the test cases nonaffine even if Polly some days gains support for
the srem instruction, an instruction which is currently not modeled but which
can clearly be modeled statically. A call to a function without definition
will always remain non-affine, as there is just insufficient static information
for it to be modeled more precisely.

llvm-svn: 240458
2015-06-23 20:55:05 +00:00
Tobias Grosser 6ca162e6e0 Add git patch files to .gitignore
llvm-svn: 240457
2015-06-23 20:55:01 +00:00
Michael Kruse f22855079a Use C99 to compile ISL
ISL with small integer optimization requires C99 to compile. gcc < 5.0
still uses C89 as default, so we need to enable the options to compile
in C99 mode.

This patch is preparing the actual activation of small integer
optimization.

Differential version: http://reviews.llvm.org/D10610

Reviewers: grosser
llvm-svn: 240322
2015-06-22 20:31:16 +00:00
Michael Kruse 9a4e22eea1 Make CMake generate isl/stdint.h
ISL's ./configure examines the system for the stdint.h to include and
creates a header file that points to it. On C99-compatible system

    #include <stdint.h>

is always valid such there no need for system introspection. This should
unbreak the build bots.

llvm-svn: 240315
2015-06-22 18:47:39 +00:00
Tobias Grosser 967c1e0b93 Handle zero-element ArrayRefs in CUDA run-time debug builder
llvm-svn: 240312
2015-06-22 18:45:23 +00:00
Michael Kruse 0c1c55345d Replace repository version of ISL by 'make dist' output
The 'make dist' archive is not dependent on ./configure output and
contains a GIT_HEAD_ID file that identifies the version of ISL used.

None of the files added or removed are used part of Polly's build
process (except of GIT_HEAD_ID since the previous revision r240301). No
functional change intended.

llvm-svn: 240306
2015-06-22 18:07:42 +00:00
Michael Kruse ee512e58a3 Prepare replacing ISL by its 'make dist' files
Currently the Polly repository contains the ISL sources with bogus
isl_config.h and gitversion.h. This is problematic. In this state a
 macro

    #define __attribute__(x)

becomes active in the source, leading to various problems e.g. when
included before system header files. This patch will instead generate
the two files specific to the host system at configure-time.

For CMake, we replicate the tests that ISL's configure performs using
try_compile(). In autotools build, we just invoke ISL's configure to
generate the two files. This consequently required regenerating
autoconf/configure.

'make dist' distributions of ISL contain a file GIT_HEAD_ID which
contains the version the distribution is derived from. The repository
files themselves do not contain such a hint. In a later commit we will
replace the isl directory by the contents of such a .tar.gz. It does
not contain the files imdrover.c iprime.c pi.c and rsamath.c currently
compiled into Polly, but not used and therefore are removed by this
patch.

In the long term we plan to generate a dedicated library for ISL instead
of adding its files to Polly.

This also does not yet include the switch to small-integer optimized ISL
nor enabling C99 mode required for the former. Those will come as well
in separate patches.

Differential version: http://reviews.llvm.org/D10603

Reviewers: grosser 
llvm-svn: 240301
2015-06-22 17:52:33 +00:00
David Blaikie de867e1ee9 Fix the clang -Werror build (-Wbraced-scalar-init)
llvm-svn: 240172
2015-06-19 20:07:18 +00:00
Tobias Grosser e7e628cc07 Add NVIDIA vprintf printing to RuntimeDebugBuilder
2nd try, this time with the corresponding LLVM IRBuilder changes in place.

llvm-svn: 240119
2015-06-19 02:33:45 +00:00
Michael Kruse 21a24730d0 Update external project versions in README.txt
This was meant to committed in r240027, but was left behind because 
svn, in contrast to git, only commits the changes in the directory you
are currently in.

llvm-svn: 240034
2015-06-18 18:07:06 +00:00
Michael Kruse c59f22c556 Update ISL to isl-0.15-3-g532568a
This version adds small integer optimization, but is not active by
default. It will be enabled in a later commit.
    
The schedule-fuse=min/max option has been replaced by the
serialize-sccs option. Adapting Polly was necessary, but retaining the
name polly-opt-fusion=min/max.

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

Reviewers: grosser
llvm-svn: 240027
2015-06-18 16:45:40 +00:00
Tobias Grosser aa9f575ae1 Adjust to personality function change in 239940
llvm-svn: 239992
2015-06-18 05:02:11 +00:00
Chandler Carruth afa4ea7121 [PM/AA] Update Polly for r239886 which removed UnknownSize from
AliasAnalysis by getting it from its newly canonical home of
MemoryLocation::UnknownSize.

llvm-svn: 239890
2015-06-17 08:29:32 +00:00
Michael Kruse dd6011c494 Orthography: substracting -> subtracting
This is a test commit for being granted commit-after-approval access.

llvm-svn: 239725
2015-06-15 10:52:28 +00:00
Tobias Grosser 039955a44c Revert "Add NVIDIA vprintf printing to RuntimeDebugBuilder"
This reverts commit 239219 which requires some LLVM changes I forgot to commit.

Reported-by: Marshall Clow
llvm-svn: 239306
2015-06-08 16:24:49 +00:00
Tobias Grosser 6091417ebc Add NVIDIA vprintf printing to RuntimeDebugBuilder
llvm-svn: 239219
2015-06-06 08:43:22 +00:00
Tobias Grosser d8308fbed9 Avoid the use of std::map emplace
This functionality does not yet seem to exist on all buildbots.

llvm-svn: 239133
2015-06-05 05:52:15 +00:00
Tobias Grosser 785ee20cac Free two strings produced by isl
With this commit 'make check-polly' is now address sanitizer clean.

llvm-svn: 239131
2015-06-05 05:31:46 +00:00
Tobias Grosser d5d93ecd03 Use owning pointers to avoid memory leaks
This fixes a memory leak caused by us not freeing the expanded region nodes.

llvm-svn: 239061
2015-06-04 17:59:54 +00:00
Tobias Grosser 8199c722c7 Disable output for test case that does not need output
llvm-svn: 239060
2015-06-04 17:59:51 +00:00
Tobias Grosser a5c092d844 Store ArrayShape in shared_ptr and MemAccs as actual objects
This fixes two more memory leaks.

llvm-svn: 239050
2015-06-04 16:03:16 +00:00
Tobias Grosser ff22e9e5f6 Store comparison objects as objects, not pointers
This fixes a memory leak. If we store the actual objects we can not forget to
free them.

llvm-svn: 239033
2015-06-04 11:44:09 +00:00
Tobias Grosser 22adfb4373 Mark sdivs as 'exact' instead of lowering them ourselves
LLVM's instcombine already translates power-of-two sdivs that are known to be
exact to fast ashr instructions. Hence, there is no need to add this logic
ourselves.

Pointed-out-by: Johannes Doerfert
llvm-svn: 239025
2015-06-04 07:45:09 +00:00
Tobias Grosser 5cf7860704 Ensure memory access mappings are defined for full domain
We now verify that memory access functions imported via JSON are indeed defined
for the full iteration domain. Before this change we accidentally imported
memory mappings such as i -> i / 127, which only defined a mapped for values of
i that are evenly divisible by 127, but which did not define any mapping for the
remaining values, with the result that isl just generated an access expression
that had undefined behavior for all the unmapped values.

In the incorrect test cases, we now either use floor(i/127) or we use p/127 and
provide the information that p is indeed a multiple of 127.

llvm-svn: 239024
2015-06-04 07:44:35 +00:00
Chandler Carruth bdb4a39ad8 Update Polly for the AA/MemoryLocation refactoring.
llvm-svn: 239008
2015-06-04 03:49:46 +00:00
Tobias Grosser a441305564 [doc] Rename -polly-detect-only= to -polly-only-func=
llvm-svn: 238930
2015-06-03 15:45:19 +00:00
Tobias Grosser 244c8297cf Lower signed-divisions without rounding to ashr instructions
llvm-svn: 238929
2015-06-03 15:14:58 +00:00
Tobias Grosser 224b162280 Only convert power-of-two floor-division with non-negative denominator
floord(a,b) === a ashr log_2 (b) holds for positive and negative a's, but
shifting only makes sense for positive values of b. The previous patch did
not consider this as isl currently always produces postive b's. To avoid future
surprises, we check that b is positive and only then apply the optimization.

We also now correctly check the return value of the dyn-cast.

No additional test case, as isl currently does not produce negative
denominators.

Reported-by: David Majnemer <david.majnemer@gmail.com>
llvm-svn: 238927
2015-06-03 14:43:01 +00:00
Tobias Grosser cb73f150d4 Translate power-of-two floor-division into ashr
Power-of-two floor divisions can be translated into an arithmetic shift
operation. This allows us to replace a complex lowering that requires division
operations:

  %pexp.fdiv_q.0 = sub i64 %21, 128
  %pexp.fdiv_q.1 = add i64 %pexp.fdiv_q.0, 1
  %pexp.fdiv_q.2 = icmp slt i64 %21, 0
  %pexp.fdiv_q.3 = select i1 %pexp.fdiv_q.2, i64 %pexp.fdiv_q.1, i64 %21
  %pexp.fdiv_q.4 = sdiv i64 %pexp.fdiv_q.3, 128

with a simple ashr:

  %polly.fdiv_q.shr = ashr i64 %21, 7

llvm-svn: 238905
2015-06-03 06:31:30 +00:00
Tobias Grosser 97d8745087 Dump YAML schedule tree as properly indented tree in DEBUG output
llvm-svn: 238645
2015-05-30 06:46:59 +00:00
Tobias Grosser d6a50b3a1e Add DEBUG output to -polly-scops pass
llvm-svn: 238644
2015-05-30 06:26:21 +00:00
Tobias Grosser 3e77d14563 Add indvar pass to canonicalization sequence
Running indvar before Polly is useful as this eliminates zexts as they commonly
appear when a 32 bit induction variable (type int) was used on a 64 bit system.
These zexts confuse our delinearization and prevent for example the successful
delinearization of the nussinov kernel in polybench-c-4.1.

This fixes http://llvm.org/PR23426

Suggested-by: Xing Su <xsu.llvm@outlook.com>
llvm-svn: 238643
2015-05-30 06:16:41 +00:00
Tobias Grosser cdb38e5625 Exploit non-negative numerators
isl marks known non-negative numerators in modulo (and soon also division)
operations. We now exploit this by generating unsigned operations. This is
beneficial as unsigned operations with power-of-two denominators will be
translated by isl to fast bitshift or bitwise and operations.

llvm-svn: 238577
2015-05-29 17:08:19 +00:00
Tobias Grosser b2f399264d Update isl to 93b8e43d
This update brings mostly interface cleanups, but also fixes two bugs in
imath (a memory leak, some undefined behavior).

llvm-svn: 238422
2015-05-28 13:32:11 +00:00
Tobias Grosser 57411e3fc6 Drop const in front of iterator
David Blaikie:

"find returns an iterator by value, so it's just added complexity/strangeness to
then use reference lifetime extension to give it the same semantics as if you'd
used a value type instead of a reference type."

llvm-svn: 238294
2015-05-27 06:51:34 +00:00
Tobias Grosser 7c3bad52dd Use value semantics for list of ScopStmt(s) instead of std::owningptr
David Blaike suggested this as an alternative to the use of owningptr(s) for our
memory management, as value semantics allow to avoid the additional interface
complexity caused by owningptr while still providing similar memory consistency
guarantees. We could also have used a std::vector, but the use of std::vector
would yield possibly changing pointers which currently causes problems as for
example the memory accesses carry pointers to their parent statements. Such
pointers should not change.

Reviewer: jblaikie, jdoerfert

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

llvm-svn: 238290
2015-05-27 05:16:57 +00:00
Tobias Grosser eeb9f3ce15 Drop unnecessary 'this->' pointers
llvm-svn: 238257
2015-05-26 21:37:31 +00:00
Tobias Grosser c825fae020 Tighten the PHI modeling test cases
While looking through the test cases I realized we did not have a CHECK line
for a duplicate memory access which we may want to eliminate later. To ensure
we do not have (or later introduce) unnecessary memory accesses, we now tighten
the test cases to look for such a pattern (and add the CHECK: line that shows
the redundant memory access).

llvm-svn: 238227
2015-05-26 18:05:45 +00:00
Tobias Grosser 2d7611f45e Remove unnecessary indirection through SCEV
llvm-svn: 238092
2015-05-23 05:58:30 +00:00
Tobias Grosser ab6714464a Use unique_ptr to clarify ownershop of ScopArrayInfoMap
llvm-svn: 238091
2015-05-23 05:58:27 +00:00
Tobias Grosser 679dfafd33 Use unique_ptr to clarify ownership of ScopStmt
llvm-svn: 238090
2015-05-23 05:14:09 +00:00
Tobias Grosser ac60f4594f Enable scalar and PHI code generation for Polly
The feature itself has been committed by Johannes in r238070. As this is the
way forward, we now enable it to ensure we get test coverage.

Thank you Johannes for this nice work!

llvm-svn: 238088
2015-05-23 03:34:41 +00:00
Tobias Grosser 268205939f Make use of scalar/phi code generation explicit in the tests
This ensures we pass all tests independently of how we set the options
-disable-polly-intra-scop-scalar-to-array and -polly-model-phi-nodes.

(At least if we enable both or disable both. Enabling them individually makes
 little sense, as they will hopefully disappear soon anyhow).

llvm-svn: 238087
2015-05-23 03:34:35 +00:00
Johannes Doerfert ecff11dcfb Add scalar and phi code generation
To reduce compile time and to allow more and better quality SCoPs in
  the long run we introduced scalar dependences and PHI-modeling. This
  patch will now allow us to generate code if one or both of those
  options are set. While the principle of demoting scalars as well as
  PHIs to memory in order to communicate their value stays the same,
  this allows to delay the demotion till the very end (the actual code
  generation). Consequently:
    - We __almost__ do not modify the code if we do not generate code
      for an optimized SCoP in the end. Thus, the early exit as well as
      the unprofitable option will now actually preven us from
      introducing regressions in case we will probably not get better
      code.
    - Polly can be used as a "pure" analyzer tool as long as the code
      generator is set to none.
    - The original SCoP is almost not touched when the optimized version
      is placed next to it. Runtime regressions if the runtime checks
      chooses the original are not to be expected and later
      optimizations do not need to revert the demotion for that part.
    - We will generate direct accesses to the demoted values, thus there
      are no "trivial GEPs" that select the first element of a scalar we
      demoted and treated as an array.

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

llvm-svn: 238070
2015-05-22 23:43:58 +00:00
Tobias Grosser 1b6ea573f2 Replace low-level constraint building with higher level functions
Instead of explicitly building constraints and adding them to our maps we
now use functions like map_order_le to add the relevant information to the
maps.

llvm-svn: 237934
2015-05-21 19:02:44 +00:00
Tobias Grosser a8512b1784 Add diagnostic for unsigned integer comparisions
llvm-svn: 237800
2015-05-20 15:37:11 +00:00
Tobias Grosser 9a6bef8ba4 Drop redundant condition
This condition was accidentally introduced in r211875.

llvm-svn: 237796
2015-05-20 15:04:27 +00:00
Tobias Grosser 5db5d2da13 Use base-pointer address space when creating new access functions
llvm-svn: 237785
2015-05-20 11:02:12 +00:00
Tobias Grosser 49ad36ca16 Add printing and testing to ScopArrayInfo
Being here, we extend the interface to return the element type and not a pointer
to the element type. We also provide a function to get the size (in bytes) of
the elements stored in this array.

We currently still store the element size as an innermost dimension in
ScopArrayInfo, which is somehow inconsistent and should be addressed in future
patches.

llvm-svn: 237779
2015-05-20 08:05:31 +00:00
Tobias Grosser 1128b36512 Adapt to IRBuilder::CreateCall interface change
The IRBuilder::CreateCall interface was changed in r237624 and now requires an
initializer list.

llvm-svn: 237666
2015-05-19 06:25:02 +00:00
Tobias Grosser 1638f987f1 Update isl to 6be6768e
Besides a couple of interface cleanups, this change also contains a performance
optimization of isl_mat_product that should give us up to almost 6% compiletime
reduction.

llvm-svn: 237616
2015-05-18 21:29:58 +00:00
Tobias Grosser b80def51e1 Drop unused PTX generator file
This code has been part of Polly's GPGPU backend, which has been remove together
with the code generation backend. Development now continues in an out-of-tree
branch.

llvm-svn: 237450
2015-05-15 15:41:14 +00:00
Tobias Grosser 4ac75ba449 Remove need for separate loop index counter
Suggested-by: Johannes Doerfert
llvm-svn: 237441
2015-05-15 12:24:12 +00:00
Tobias Grosser e29d31ce5a Simplify string formatting
Suggested-by: Johannes Doerfert
llvm-svn: 237440
2015-05-15 12:24:09 +00:00
Tobias Grosser 6f48e0fd2b Give each memory access a reference ID
This reference ID is handy for use cases where we need to identify individual
memory accesses (e.g. to modify their access functions).

This is a reworked version of a patch originally developed by Yabin Hu as part
of his summer of code project.

llvm-svn: 237431
2015-05-15 09:58:32 +00:00
Tobias Grosser e0f8d597f4 Update isl to 9f767f1766a0
This fixes a bug in the isl scheduler (http://llvm.org/PR21934)

Otherwise mostly minor changes.

llvm-svn: 237250
2015-05-13 13:10:13 +00:00
Sunil Srivastava 19be68f088 Changed renaming of local symbols by inserting a dot before the numeric suffix.
Modified two test cases to adjust to the above change in renaming.
These two files were causing the buildbot failure in Polly, #30204 for example.
Details in http://reviews.llvm.org/D9483
This checkin goes with r237150 and r237151

llvm-svn: 237203
2015-05-12 22:44:24 +00:00
Tobias Grosser 09d3069740 Rename IslCodeGeneration to CodeGeneration
Besides class, function and file names, we also change the command line option
from -polly-codegen-isl to just -polly-codegen. The isl postfix is a leftover
from the times when we still had the CLooG based -polly-codegen. Today it is
just redundant and we drop it.

llvm-svn: 237099
2015-05-12 07:45:52 +00:00
Tobias Grosser d4ea2f48c4 Revert "Adjust formatting to latest clang-format change"
This reverts commit 236875. Daniel fixed the clang-format bug that introduced
the changed formatting.

llvm-svn: 236994
2015-05-11 13:43:04 +00:00
Tobias Grosser 3e6070ef03 Update isl to c3892bebc0
Various smaller improvements and bugfixes.

llvm-svn: 236932
2015-05-09 09:37:30 +00:00
Tobias Grosser cd524dc51d Add explicit #includes for used isl features
llvm-svn: 236931
2015-05-09 09:36:38 +00:00
Tobias Grosser ba0d09227c Sort include directives
Upcoming revisions of isl require us to include header files explicitly, which
have previously been already transitively included. Before we add them, we sort
the existing includes.

Thanks to Chandler for sort_includes.py. A simple, but very convenient script.

llvm-svn: 236930
2015-05-09 09:13:42 +00:00
Tobias Grosser f7b5480474 Adjust formatting to latest clang-format change
llvm-svn: 236875
2015-05-08 16:10:53 +00:00
Tobias Grosser d35f388b49 [cmake] Remove two unused include paths
These include paths are leftovers from times when we used GMP or an external
isl installation. They are not longer needed.

llvm-svn: 236596
2015-05-06 12:28:23 +00:00
Tobias Grosser e71ed19841 Add iterators for the ArrayInfo objects of the scop
This patch also changes the implementation of the ArrayInfoMap to a MapVector
which will ensure that iterating over the list of ArrayInfo objects gives
predictable results. The single loop that currently enumerates the ArrayInfo
objects only frees the individual objectes, hence a possibly changing
iteration order does not affect the outcome. The added robustness is for
future users of this interface.

llvm-svn: 236583
2015-05-06 10:05:20 +00:00
Johannes Doerfert 8983031b5e [FIX] Invalid recognition of multidimensional access
In the lnt benchmark MultiSource/Benchmarks/MallocBench/gs/gs with
  scalar and PHI modeling we detected the multidimensional accesses
  with sizes variant in the SCoP. This will check the sizes for validity.

llvm-svn: 236395
2015-05-03 16:03:01 +00:00
Tobias Grosser a63b7cee66 Adding debug location information to Polly's JSCOP and dot exports
This change adds location information for the detected regions in Polly when the
required debug information is available.

The JSCOP output format is extended with a "location" field which contains the
information in the format "source.c:start-end"

The dot output is extended to contain the location information for each nested
region in the analyzed function.

As part of this change, the existing getDebugLocation function has been moved
into lib/Support/ScopLocation.cpp to avoid having to include
polly/ScopDetectionDiagnostics.h.

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

Contributed-by: Roal Jordans <r.jordans@tue.nl>
llvm-svn: 236393
2015-05-03 05:21:36 +00:00
Duncan P. N. Exon Smith ddf3a0ef38 Update polly for LLVM rename of debug info metadata with DI* prefix
Ran the same rename-md-di-prefix.sh script attached to PR23080 as in
LLVM r236120 and CFE r236121.

llvm-svn: 236127
2015-04-29 17:02:14 +00:00
Tobias Grosser 0c55cb6071 Extract IslNodeBuilder into its own file
The IslNodeBuilder is a generic class that may be useful in other contexts
as well. Hence, we extract it into its own .h/.cpp file.

llvm-svn: 235873
2015-04-27 12:32:24 +00:00
Tobias Grosser f3ba5b5a40 Drop some unused headers
llvm-svn: 235871
2015-04-27 12:17:22 +00:00
Tobias Grosser 4245372bee Fix PTXGenerator after raw_pwrite_stream has been introduced
Without this patch Polly with GPGPU support enabled did not compile any more.

llvm-svn: 235868
2015-04-27 12:06:32 +00:00
Tobias Grosser 1346663551 Fix formatting issues in banner
llvm-svn: 235867
2015-04-27 12:02:36 +00:00
Tobias Grosser 8fd2390053 Do not expose code generator choice in the header
There is no need for other passes to access the code-generator command-line
option. Hence, drop it from the header to simplify the interface.

llvm-svn: 235866
2015-04-27 12:02:33 +00:00
Tobias Grosser 6325cd2fcd Remove flag '-polly-annotate-alias-scopes'
This option is enabled since a long time and there does not seem to be a
situation in which we would not want to print alias scopes. Remove this option
to reduce the set of command-line option combinations that may expose bugs.

llvm-svn: 235861
2015-04-27 10:43:10 +00:00
Tobias Grosser b68068bf62 Remove implementation of getNumberOfIterations from header [NFC]
We moved this implementation into the header file to share it between
the CLooG and isl code generator. As the CLooG code generator was dropped,
the implementation can be folded back into the .cpp file.

No functional change intended.

llvm-svn: 235860
2015-04-27 10:38:45 +00:00
Johannes Doerfert 8f8af43fef Use all available range information for parameters
In the following even full-range information will help to avoid
  runtime checks for wrapping integers, hence we enable it now.

llvm-svn: 235823
2015-04-26 20:07:21 +00:00
Johannes Doerfert d5d8f67dc5 Use the original no-wrap flags for normalized AddRecs
llvm-svn: 235822
2015-04-26 19:55:21 +00:00
Tobias Grosser 2165de8894 JScoP Import/Export: Ensure parameters have the same isl_id
When reading parameters from a JSON file parameters with identical names
may be related to different isl_ids, which then causes isl to treat them
as differnet objects. This does not cause issues at the moment, but has
shown problematic in subsequent schedule tree changes.

This commit will be tested by the following changes.

llvm-svn: 235588
2015-04-23 12:23:56 +00:00
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