Commit Graph

2462 Commits

Author SHA1 Message Date
Tobias Grosser 77e2128580 docs: Fix section header committed in r264575
Ensure the length of the header underline matches the length of the header.
This prevents SPHINX from erroring on this file and consequently not updating
the documentation.

Also, make this its own point not belonging to the 'increased applicability'
section.

llvm-svn: 264592
2016-03-28 17:00:14 +00:00
Hongbin Zheng 52ae58259d Add fine-grain dependences analysis to release notes.
Differential Revision: http://reviews.llvm.org/D17905

llvm-svn: 264575
2016-03-28 12:41:49 +00:00
Johannes Doerfert 6462d8c1d9 Generalize the domain complexity restrictions
This patch applies the restrictions on the number of domain conjuncts
  also to the domain parts of piecewise affine expressions we generate.
  To this end the wording is change slightly. It was needed to support
  complex additions featuring zext-instructions but it also fixes PR27045.

  lnt profitable runs reports only little changes that might be noise:
  Compile Time:
    Polybench/[...]/2mm                     +4.34%
    SingleSource/[...]/stepanov_container   -2.43%
  Execution Time:
    External/[...]/186_crafty               -2.32%
    External/[...]/188_ammp                 -1.89%
    External/[...]/473_astar                -1.87%

llvm-svn: 264514
2016-03-26 16:17:00 +00:00
Tobias Grosser 7dcae2e14a Add files forgotten in r264452
llvm-svn: 264460
2016-03-25 20:32:51 +00:00
Tobias Grosser 37034db826 Update to isl-0.16.1-145-g243bf7c
Just an import to keep track with the latest version of isl. We are not looking
for specific features.

llvm-svn: 264452
2016-03-25 19:38:18 +00:00
Tobias Grosser e34aa7f482 Add title above the release notes
llvm-svn: 264448
2016-03-25 19:23:54 +00:00
Tobias Grosser 7a1e66b98a docs: Show two levels of content in index:
llvm-svn: 264447
2016-03-25 19:23:52 +00:00
Tobias Grosser 054ca24be7 docs: Describe Polly in the LLVM pass pipeline
llvm-svn: 264446
2016-03-25 19:23:44 +00:00
Tobias Grosser ddca355fe3 docs: Clearify that our release note describe the upcoming release of Polly
llvm-svn: 264406
2016-03-25 14:22:53 +00:00
Tobias Grosser 99807e4058 www: Directly link to our new SPHINX documentation
llvm-svn: 264405
2016-03-25 14:19:34 +00:00
Tobias Grosser 563c57b2e7 docs: Add links to the old documentation
llvm-svn: 264404
2016-03-25 14:18:42 +00:00
Tobias Grosser e16b8df605 Center picture
llvm-svn: 264402
2016-03-25 14:09:40 +00:00
Tobias Grosser 063ca0fc50 docs: Add architecture diagram
llvm-svn: 264400
2016-03-25 13:44:30 +00:00
Tobias Grosser 938d9cc03e www: Reference doxygen documentation directly from the menu
llvm-svn: 264399
2016-03-25 13:09:36 +00:00
Tobias Grosser 779576406f www; Drop memory access documentation
This is an old google summer of code project that has been replaced completely
by our new AST generator.

llvm-svn: 264398
2016-03-25 13:04:19 +00:00
Tobias Grosser 25a99e98c4 cmake: Ensure tools/* is still formatted
This got accidentally dropped in r264283.

Also, drop the wwwfiles from the removal list. This is not needed any more as
we now explicitly list the directories that should be formatted.

llvm-svn: 264397
2016-03-25 12:16:17 +00:00
Tobias Grosser b339594f5d CodegenCleanup: Drop -load-combine pass
This pass is not enabled in the default tool chain and currently can run into an
infinite loop, due to other parts of LLVM generating incorrect IR
(http://llvm.org/PR27065) -- which is not executed and consequently does not
seem to disturb other passes.  As this pass is not really needed, we can just
drop it to get our build clean.

This fixes the timeout issues in MultiSource/Benchmarks/MiBench/consumer-jpeg
and MultiSource/Benchmarks/mediabench/jpeg/jpeg-6a/cjpeg for
-polly-position=before-vectorizer -polly-process-unprofitable.. Unfortunately,
we are still left with a miscompile in cjpeg.

llvm-svn: 264396
2016-03-25 12:11:06 +00:00
Johannes Doerfert 6af7700ddf [CMAKE] Try to find the correct globbing expression
llvm-svn: 264286
2016-03-24 14:31:49 +00:00
Johannes Doerfert 733ea34f38 [FIX] Handle accesses to "null" in MemIntrinsics
This fixes PR27035. While we now exclude MemIntrinsics from the
  polyhedral model if they would access "null" we could exploit this
  even more, e.g., remove all parameter combinations that would lead to
  the execution of this statement from the context.

llvm-svn: 264284
2016-03-24 13:50:04 +00:00
Johannes Doerfert 8ff253bfbf Restrict clang-format to lib/ [NFC]
llvm-svn: 264283
2016-03-24 13:49:39 +00:00
Johannes Doerfert 549768c01a [FIX] Verify the alias group before returning it
Similar to r262612 we need to check not only the pointer SCEV and the
type of an alias group but also the actual access instruction. The
reason is again the same: The pointer SCEV is not flow sensitive but the
access function is. In r262612 we avoided consolidating alias groups
even though the pointer SCEV and the type were the same but the access
function was not. Here it is simpler as we can simply check all members
of an alias group against the given access instruction.

llvm-svn: 264274
2016-03-24 13:22:16 +00:00
Johannes Doerfert 9ea44aee64 [DOCS] Exclude python and shell scripts
llvm-svn: 264273
2016-03-24 13:21:12 +00:00
Johannes Doerfert 47197fe3f3 Add namespace for struct [NFC]
This will clean up the doxygen documentation.

llvm-svn: 264272
2016-03-24 13:20:52 +00:00
Johannes Doerfert 01b723ba43 Remove obsolete CMD option [NFC]
llvm-svn: 264270
2016-03-24 13:19:51 +00:00
Johannes Doerfert 2b470e8e61 Remove obsolete code
Since r261226 we should not see this situation any more, if so it is probably
  a bug that would only be hidden.

llvm-svn: 264269
2016-03-24 13:19:16 +00:00
Johannes Doerfert 13d5d5b184 Remove weird comment [NFC]
llvm-svn: 264268
2016-03-24 13:16:49 +00:00
Tobias Grosser 25e8ebe29d Drop explicit -polly-delinearize parameter
Delinearization is now enabled by default and does not need to explicitly need
to be enabled in our tests.

llvm-svn: 264154
2016-03-23 13:21:02 +00:00
Tobias Grosser 6895d9587e www: Drop one more </div>
llvm-svn: 264144
2016-03-23 09:27:41 +00:00
Tobias Grosser 00c85c6f2f www: Drop polyhedral news reference.
The feed2html service used has been unavailable a couple of times and always
causes the polly website to fail to load correctly.

llvm-svn: 264143
2016-03-23 09:26:39 +00:00
Tobias Grosser bfb6a9683b Codegen:Do not invalidate dominator tree when bailing out during code generation
When codegenerating invariant loads in some rare cases we cannot generate code
and bail out. This change ensures that we maintain a valid dominator tree
in these situations. This fixes llvm.org/PR26736

Contributed-by: Matthias Reisinger <d412vv1n@gmail.com>
llvm-svn: 264142
2016-03-23 06:57:51 +00:00
Tobias Grosser 898a636210 Add option to disallow modref function calls in scops.
This might be useful to evaluate the benefit of us handling modref funciton
calls. Also, a new bug that was triggered by modref function calls was
recently reported http://llvm.org/PR27035. To ensure the same issue does not
cause troubles for other people, we temporarily disable this until the bug
is resolved.

llvm-svn: 264140
2016-03-23 06:40:15 +00:00
Michael Kruse 49a59ca093 [ScopInfo] Fix domains after loops.
ISL can conclude additional conditions on parameters from restrictions
on loop variables. Such conditions persist when leaving the loop and the
loop variable is projected out. This results in a narrower domain for
exiting the loop than entering it and is logically impossible for
non-infinite loops.

We fix this by not adding a lower bound i>=0 when constructing BB
domains, but defer it to when also the upper bound it computed, which
was done redundantly even before this patch.

This reduces the number of LNT fails with -polly-process-unprofitable
-polly-position=before-vectorizer from 8 to 6.

llvm-svn: 264118
2016-03-22 23:27:42 +00:00
Tobias Grosser 5a8c052baf Invalidate scop on encountering a complex control flow
We bail out if current scop has a complex control flow as this could lead to
building of large domain conditions. This is to reduce compile time.  This
addresses r26382.

Contributed-by: Chris Jenneisch <chrisj@codeaurora.org>

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

llvm-svn: 264105
2016-03-22 22:05:32 +00:00
Tobias Grosser 0904c69110 ScopInfo: Do not generate dependences for i1 values used in affine branches
Affine branches are fully modeled and regenerated from the polyhedral domain and
consequently do not require any input conditions to be propagated.

llvm-svn: 263678
2016-03-16 23:33:54 +00:00
Tobias Grosser 0c2adbc7a0 MemAccInt: Do not strip pointer casts
This mirrors:

commit  https://llvm.org/svn/llvm-project/llvm/trunk@263462
Author: Michael Kuperstein <michael.kuperstein@gmail.com>
Date:   Mon Mar 14 18:34:29 2016 +0000

    [AliasSetTracker] Do not strip pointer casts when processing MemSetInst

and fixes the failure the above commit triggered in Polly.

llvm-svn: 263538
2016-03-15 06:35:08 +00:00
Mehdi Amini 16c445ae92 Revert "Revert "Update Polly for the removal of PreserveNames from IRBuilder stuff""
This reverts commit r263322 and reapplies r263296. The original
r263258 was reapplied in LLVM after being reverted in r263321 due to
issues with Release testing in Clang.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 263399
2016-03-13 22:21:43 +00:00
David Blaikie a0d9990c59 Revert "Update Polly for the removal of PreserveNames from IRBuilder stuff"
The original r263258 was reverted in r263321 due to issues with Release
testing.

This reverts commit r263296.

llvm-svn: 263322
2016-03-12 01:53:28 +00:00
David Blaikie e16dc34e97 Update Polly for the removal of PreserveNames from IRBuilder stuff
llvm-svn: 263296
2016-03-11 21:33:58 +00:00
Tobias Grosser 114180db5b Also clang-format *.c run-time library files
llvm-svn: 262917
2016-03-08 07:34:58 +00:00
Tobias Grosser 45a8534893 doxygen: Also show private members
llvm-svn: 262859
2016-03-07 21:38:19 +00:00
Tobias Grosser f0458ea170 doxygen: Fix region marker
llvm-svn: 262858
2016-03-07 21:35:01 +00:00
Tobias Grosser 43fb775fc9 Drop comment separators
The cause trouble in the doxygen output.

llvm-svn: 262857
2016-03-07 21:26:41 +00:00
Tobias Grosser 6733ba826a docs: Add doxygen mainpage
(and test if doxygen is updated on-commit)

llvm-svn: 262855
2016-03-07 21:17:48 +00:00
Tobias Grosser af97a282b9 Test documentation rebuild
llvm-svn: 262850
2016-03-07 20:44:20 +00:00
Michael Kruse afd2db5351 [SCEVValidator] Fix loop exit values considered affine.
Index calculations can use the last value that come out of a loop.
Ideally, ScalarEvolution can compute that exit value directly without
depending on the loop induction variable, but not in all cases.

This changes isAffine to not consider such loop exit values as affine to
avoid that SCEVExpander adds uses of the original loop induction
variable.

This fix is analogous to r262404 that applies to general uses of loop
exit values instead of index expressions and loop bouds as in this
patch.

This reduces the number of LNT test-suite fails with
-polly-position=before-vectorizer -polly-unprofitable
from 10 to 8.

llvm-svn: 262665
2016-03-03 22:10:52 +00:00
Michael Kruse 09eb4451d2 Pass scope and LoopInfo to SCEVValidator. NFC.
The scope will be required in the following fix. This commit separates
the large changes that do not change behaviour from the small, but
functional change.

llvm-svn: 262664
2016-03-03 22:10:47 +00:00
Tobias Grosser 2880f10aa4 tests: Fix some spelling mistakes
llvm-svn: 262649
2016-03-03 19:51:03 +00:00
Tobias Grosser 4e442d75e5 docs: Fix some spelling mistakes
llvm-svn: 262647
2016-03-03 19:48:30 +00:00
Michael Kruse faedfcbf6d [BlockGenerator] Fix PHI merges for MK_Arrays.
Value merging is only necessary for scalars when they are used outside
of the scop. While an array's base pointer can be used after the scop,
it gets an extra ScopArrayInfo of type MK_Value. We used to generate
phi's for both of them, where one was assuming the reault of the other
phi would be the original value, because it has already been replaced by
the previous phi. This resulted in IR that the current IR verifier
allows, but is probably illegal.

This reduces the number of LNT test-suite fails with
-polly-position=before-vectorizer -polly-process-unprofitable
from 16 to 10.

Also see llvm.org/PR26718.

llvm-svn: 262629
2016-03-03 17:20:43 +00:00
Johannes Doerfert ac37c565b5 Fix typo [NFC]
llvm-svn: 262613
2016-03-03 12:30:19 +00:00
Johannes Doerfert df88023d2b [FIX] Consolidation of loads with same pointer but different access relation
This should fix PR19422.

  Thanks to Jeremy Huddleston Sequoia for reporting this.
  Thanks to Roman Gareev for his investigation and the reduced test case.

llvm-svn: 262612
2016-03-03 12:26:58 +00:00
Johannes Doerfert 0a21113a52 [DOC] Add documentation for the supported call instructions
llvm-svn: 262608
2016-03-03 11:33:49 +00:00
Johannes Doerfert d1be3b05bb [DOC] Add more documentation about the different element type support
llvm-svn: 262607
2016-03-03 11:33:30 +00:00
Hongbin Zheng 2a798853f8 Allow the client of DependenceInfo to obtain dependences at different granularities.
llvm-svn: 262591
2016-03-03 08:15:33 +00:00
Tobias Grosser a64c8233b8 www: Add links to sphinx/doxygen documentation
llvm-svn: 262589
2016-03-03 07:03:21 +00:00
Tobias Grosser b4d54d7ccd docs: Drop modindex from sphinx
For an unknown reason modindex is not be built correctly by sphinx. Take it
out of the index until we can build it correctly.

llvm-svn: 262588
2016-03-03 07:01:00 +00:00
Michael Kruse 1bf6bafb2d Fix: Add pass manager barrier.
The LNT test suite with -polly-process-unprofitable
-polly-position=before-vectorizer currenty fails 59 tests. With this
barrier added, only 16 keep failing. This is probably because Polly's
code generation currently does not correctly preserve all analyses it
promised to preserve. Temporarily add this barrier until further
investigation.

llvm-svn: 262488
2016-03-02 14:59:16 +00:00
Michael Kruse c7e0d9c216 Fix non-synthesizable loop exit values.
Polly recognizes affine loops that ScalarEvolution does not, in
particular those with loop conditions that depend on hoisted invariant
loads. Check for SCEVAddRec dependencies on such loops and do not
consider their exit values as synthesizable because SCEVExpander would
generate them as expressions that depend on the original induction
variables. These are not available in generated code.

llvm-svn: 262404
2016-03-01 21:44:06 +00:00
Michael Kruse b3a7935d54 [SCEVValidator] Remove redundant visit.
SCEVAddRecExpr::getStart() is synonymous to SCEVAddRecExpr::getOperand(0)
which will be visited in the following loop anyway.

llvm-svn: 262375
2016-03-01 19:30:54 +00:00
Johannes Doerfert 066dbf3f8e Track assumptions and restrictions separatly
In order to speed up compile time and to avoid random timeouts we now
  separately track assumptions and restrictions. In this context
  assumptions describe parameter valuations we need and restrictions
  describe parameter valuations we do not allow. During AST generation
  we create a runtime check for both, whereas the one for the
  restrictions is negated before a conjunction is build.

  Except the In-Bounds assumptions we currently only track restrictions.

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

llvm-svn: 262328
2016-03-01 13:06:28 +00:00
Johannes Doerfert abadd71da1 [FIX] Prevent compile time problems due to complex invariant loads
This cures the symptoms we see in h264 of SPEC2006 but not the cause.

llvm-svn: 262327
2016-03-01 13:05:14 +00:00
Michael Kruse 0b56681d21 [ScopDetection] Fix use-after-free.
removeCachedResults deletes the DetectionContext from
DetectionContextMap such that any it cannot be used anymore.
Unfortunately invalid<ReportUnprofitable> and RejectLogs.insert still do
use it. Because the memory is part of a map and not returned to to the
OS immediatly, such that the observable effect was only a memory leak
due to reference counters not decreased when the second call to
removeCachedResults does not remove the DetectionContext because because
it already has been removed.

Fix by not removing the DetectionContext prematurely. The second call to
removeCachedResults will handle it anyway.

llvm-svn: 262235
2016-02-29 16:54:18 +00:00
Michael Kruse c0a19b079d Reapply "Add update_test.py script."
Originally committed in r261899 and reverted in r262202 due to failing
in out-of-LLVM tree builds.

Replace the use of LLVM_TOOLS_BINARY_DIR by LLVM_TOOLS_DIR which exists
in both, in-tree and out-of-tree builds.

Original commit message:
The script updates a lit test case that uses FileCheck using the actual
output of the 'RUN:'-lines program. Useful when updating test cases due
to expected output changes and diff'ing expected and actual output.

llvm-svn: 262227
2016-02-29 14:58:13 +00:00
Tobias Grosser 0865e775bf ScopInfo: Remove indentation in hoistInvariantLoads
We move verifyInvariantLoads out of this function to allow for an early return
without the need for code duplication. A similar transformation was suggested
by Johannes Doerfert in post commit review of r262033.

llvm-svn: 262203
2016-02-29 07:29:42 +00:00
Tobias Grosser a4835c5673 Revert "Add update_test.py script."
This reverts commit r261899. Even though I am not yet 100% certain, this is
commit is the only one that has some relation to the recent cmake failures
in Polly.

llvm-svn: 262202
2016-02-29 07:12:10 +00:00
Tobias Grosser 4fb9e51664 ScopInfo: Drop some debug statements
This debug output distracts from the -debug-only=polly-scops output. As it is
rather verbose and only really needed for debugging the domain construction
I drop this output. The domain construction is meanwhile stable enough to
not require regular debugging.

llvm-svn: 262117
2016-02-27 06:59:30 +00:00
Tobias Grosser 0bed1eab39 LoopGenerators: Expose some parts of the parallel loop generator
Some of this functionality is useful beyond the generation of a normal OpenMP
loop.

llvm-svn: 262114
2016-02-27 06:24:58 +00:00
Tobias Grosser abafafe07c ScopInfo: Add function to invalidate ScopArrayInfo object
In case the underlying basepointer of a ScopArrayInfo object is moved to another
module while the scop is still processed is it necessary to free dependent
ScopArrayInfo objects as they might otherwise be looked accidentally when a
new llvm basepointer value is reassigned the very same memory location as the
llvm value that has been moved earlier.

This function is not yet used in Polly itself, but is useful for external users.

llvm-svn: 262113
2016-02-27 06:04:40 +00:00
Hongbin Zheng b1908ea5b9 Update the fine-grain dependences analysis test case.
llvm-svn: 262101
2016-02-27 01:50:01 +00:00
Hongbin Zheng 8efb22ef25 Enable llvm's isa/cast/dyn_cast on MemAccInst.
Differential Revision: http://reviews.llvm.org/D17250

llvm-svn: 262100
2016-02-27 01:49:58 +00:00
Hongbin Zheng 9691d71674 Introduce fine-grain dependence analysis by tagging access functions and schedules tree with either the id of memory access or memory references.
Differential Revision: http://reviews.llvm.org/D17381

llvm-svn: 262039
2016-02-26 17:05:24 +00:00
Tobias Grosser 8fa3e4c3fb ScopDetect/Info: Add option to disable invariant load hoisting
This is helpful for test case reduction and other experiments.

llvm-svn: 262033
2016-02-26 16:43:35 +00:00
Michael Kruse 0ac2d3e217 ScopDetection: Fix mix-up of isLoad and isStore.
This was accidentally introduced in r258947.

Thanks to Hongbin Zheng for finding this.

Found-by: etherzhhb
llvm-svn: 262032
2016-02-26 16:40:35 +00:00
Michael Kruse 37d136e48e Reduce indention. NFC.
The functions buildAccessMultiDimFixed and buildAccessMultiDimParam were
refactored from buildMemoryAccess. In their own functions, the control
flow can be shortcut and simplified using returns.

Suggested-by: etherzhhb
llvm-svn: 262029
2016-02-26 16:08:24 +00:00
Tobias Grosser f8746fc88e BlockGenerators: Allow values to be removed from ScalarMap
This function is not yet used in Polly, but is useful to external projects that
generate multi-module code using Polly.

llvm-svn: 262010
2016-02-26 13:27:02 +00:00
Tobias Grosser 64ca00c344 IslAst: Expose run-time check generation as individual function
This allows to construct run-time checks for a scop without having to generate
a full AST. This is currently not taken advantage of in Polly itself, but
external users may benefit from this feature.

llvm-svn: 262009
2016-02-26 12:59:38 +00:00
Tobias Grosser a67ac9767a Update to isl-0.16.1-68-g8fad211
This commit updates to the latest isl development version. There is no specific
feature we need on the Polly side, but we want to ensure test coverage for the
latest isl changes.

llvm-svn: 262001
2016-02-26 11:35:12 +00:00
Hongbin Zheng f3d6612c0a [MemAccInst] Introduce the '->' operator and remove the simple wrapper functions. NFC
llvm-svn: 261994
2016-02-26 09:47:11 +00:00
Hongbin Zheng f43e9925ee Coalesce Read/Write/MayWrite right after we collected them. NFC
llvm-svn: 261993
2016-02-26 09:47:08 +00:00
Chandler Carruth 7553e95098 Fix a warning about an unused variable in release builds.
llvm-svn: 261956
2016-02-26 02:25:06 +00:00
Hongbin Zheng defd098612 Adapt to LLVM head, again
llvm-svn: 261905
2016-02-25 17:54:42 +00:00
Michael Kruse 9cfc49d5b5 Add update_test.py script.
The script updates a lit test case that uses FileCheck using the actual
output of the 'RUN:'-lines program. Useful when updating test cases due
expected output changes and diff'ing expected and actual output.

llvm-svn: 261899
2016-02-25 17:12:12 +00:00
Hongbin Zheng 566c614525 Revert "Adapt to LLVM head. NFC"
This reverts commit 4d3753b9646a69c00d234ccd6e91dc3d0ea5d643.

llvm-svn: 261892
2016-02-25 16:46:17 +00:00
Hongbin Zheng f4e35f9cb9 Adapt to LLVM head. NFC
llvm-svn: 261886
2016-02-25 16:36:09 +00:00
Michael Kruse 8f25b0cb4d Use inline local variable declaration. NFC.
llvm-svn: 261876
2016-02-25 15:52:43 +00:00
Tobias Grosser b9baae529f www: Fix typo
Reported-by: Hongbin Zheng
llvm-svn: 261873
2016-02-25 15:21:02 +00:00
Tobias Grosser 6b00ef338e Add Polly GSoC projects
These projects are just some first thoughts. Feel free to updated / add ideas
for further projects.

llvm-svn: 261867
2016-02-25 14:17:11 +00:00
Johannes Doerfert a792098047 Support calls with known ModRef function behaviour
Check the ModRefBehaviour of functions in order to decide whether or
  not a call instruction might be acceptable.

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

llvm-svn: 261866
2016-02-25 14:08:48 +00:00
Michael Kruse f33c125dd2 Fix DomTree preservation for generated subregions.
The generated dedicated subregion exit block was assumed to have the same
dominance relation as the original exit block. This is incorrect if the exit
block receives other edges than only from the subregion, which results in that
e.g. the subregion's entry block does not dominate the exit block.

llvm-svn: 261865
2016-02-25 14:08:48 +00:00
Johannes Doerfert 8c83078449 Simplify code [NFC]
llvm-svn: 261864
2016-02-25 14:07:49 +00:00
Johannes Doerfert 9dd42ee7c1 Try to build alias checks even when non-affine accesses are allowed
From now on we bail only if a non-trivial alias group contains a non-affine
  access, not when we discover aliasing and non-affine accesses are allowed.

llvm-svn: 261863
2016-02-25 14:06:11 +00:00
Michael Kruse 7b5caa4a72 Introduce ScopStmt::getRegionNode(). NFC.
Replace an inline ternary operator pattern.

llvm-svn: 261793
2016-02-24 22:08:28 +00:00
Michael Kruse 375cb5fe0a Introduce ScopStmt::getEntryBlock(). NFC.
This replaces an ungly inline ternary operator pattern.

llvm-svn: 261792
2016-02-24 22:08:24 +00:00
Michael Kruse 6f7721f02b Introduce Scop::getStmtFor. NFC.
Replace Scop::getStmtForBasicBlock and Scop::getStmtForRegionNode, and
add overloads for llvm::Instruction and llvm::RegionNode.

getStmtFor and overloads become the common interface to get the Stmt
that contains something. Named after LoopInfo::getLoopFor and
RegionInfo::getRegionFor.

llvm-svn: 261791
2016-02-24 22:08:19 +00:00
Michael Kruse eac9726e8c Add assertions checking def dominates use. NFC.
This is also be caught by the function verifier, but disconnected from
the place that produced it. Catch it already at creation to be able to
reason more directly about the cause.

llvm-svn: 261790
2016-02-24 22:08:14 +00:00
Michael Kruse a9c846c4ee Add assertion to MemoryAccess::addIncoming. NFC.
MemoryAccess::addIncoming exists to remember which values come from that
statement in PHI writes, relevant for subregions that have multiple
exiting edges to an exit block. The exit block can be separated from the
exiting block by regions simplifications. It should not be called for
any read accesses.

llvm-svn: 261789
2016-02-24 22:08:11 +00:00
Michael Kruse 526fcf5f0d Use inline variable declaration. NFC.
llvm-svn: 261788
2016-02-24 22:08:08 +00:00
Michael Kruse 264c3bc15a Replace std::auto_ptr with std::unique_ptr. NFC.
std::auto_ptr has been deprecated in C++11, which some compilers warn
about.

llvm-svn: 261787
2016-02-24 22:08:05 +00:00
Michael Kruse f8266fad8d Tidy test case. NFC.
The test style guide defines that opt should get its input from stdin.
(instead by file argument to avoid that the file name appears in its
output)

CHECK-FORCED is not recognized by FileCheck; remove it.

llvm-svn: 261786
2016-02-24 22:08:02 +00:00
Michael Kruse 96ba454675 Proofreading comments in DependenceInfo.h. NFC.
Typos, commas and other minor changes
(e.g. "dependences struct" -> "Dependences struct", because it is the
struct's name)

llvm-svn: 261785
2016-02-24 22:07:57 +00:00
Roman Gareev 11001e1534 Annotation of SIMD loops
Use 'mark' nodes annotate a SIMD loop during ScheduleTransformation and skip
parallelism checks.

The buildbot shows the following compile/execution time changes:

  Compile time:
    Improvements    Δ     Previous  Current  σ
    …/gesummv      -6.06% 0.2640    0.2480   0.0055
    …/gemver       -4.46% 0.4480    0.4280   0.0044
    …/covariance   -4.31% 0.8360    0.8000   0.0065
    …/adi          -3.23% 0.9920    0.9600   0.0065
    …/doitgen      -2.53% 0.9480    0.9240   0.0090
    …/3mm          -2.33% 1.0320    1.0080   0.0087

  Execution time:
    Regressions     Δ     Previous  Current  σ
    …/viterbi       1.70% 5.1840    5.2720   0.0074
    …/smallpt       1.06% 12.4920   12.6240  0.0040

Reviewed-by: Tobias Grosser <tobias@grosser.es>

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

llvm-svn: 261620
2016-02-23 09:00:13 +00:00
Johannes Doerfert 85c06c80d1 Add test case for [FIX] commit r261474
llvm-svn: 261501
2016-02-21 21:53:39 +00:00
Tobias Grosser 820cf20a98 IslAst: Expose IslAst class in header file [NFC]
This allows other passes and transformations to use some of the existing AST
building infrastructure. This is not yet used in Polly itself.

llvm-svn: 261496
2016-02-21 20:01:28 +00:00
Johannes Doerfert cea6193b79 Support memory intrinsics
This patch adds support for memcpy, memset and memmove intrinsics. They are
  represented as one (memset) or two (memcpy, memmove) memory accesses in the
  polyhedral model. These accesses have an access range that describes the
  summarized effect of the intrinsic, i.e.,
    memset(&A[i], '$', N);
  is represented as a write access from A[i] to A[i+N].

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

llvm-svn: 261489
2016-02-21 19:13:19 +00:00
Johannes Doerfert 91bb5bc862 Use regular expressions instead of temporary names for IR test [NFC]
llvm-svn: 261488
2016-02-21 18:59:35 +00:00
Johannes Doerfert b92e218ca8 [Refactor] Add missing newline after functions
llvm-svn: 261478
2016-02-21 16:37:58 +00:00
Johannes Doerfert a90943d74b [Refactor] Indicate pointer and reference types when auto is used
See also:
    http://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable

llvm-svn: 261477
2016-02-21 16:37:25 +00:00
Johannes Doerfert c5de07d8d5 [Refactor] Add newlines to separate doxygen fields
llvm-svn: 261476
2016-02-21 16:36:54 +00:00
Johannes Doerfert 68898ce3b5 [Refactor] Avoid variables with name of types
llvm-svn: 261475
2016-02-21 16:36:21 +00:00
Johannes Doerfert 85b04dedf4 [FIX] Compare SCEVs not values during SCEV expansion
This fixes a compile time bug in SPEC2006 403.gcc, namely an endless
  recursion in the ScopExpander::visitUnknown function.

llvm-svn: 261474
2016-02-21 16:36:00 +00:00
Tobias Grosser 2b809d1390 BlockGenerator: Drop unnecessary return value
llvm-svn: 261473
2016-02-21 15:44:34 +00:00
Hongbin Zheng ff4b63739e Introduce helper function to build isl_flow, NFC.
llvm-svn: 261436
2016-02-20 14:45:48 +00:00
Hongbin Zheng 403853f20b Add the missing modifier 'static' for addZeroPaddingToSchedule, NFC
llvm-svn: 261435
2016-02-20 14:45:46 +00:00
Hongbin Zheng 2ac7ee7139 Add more isl object printing functions
llvm-svn: 261402
2016-02-20 03:40:19 +00:00
Hongbin Zheng 86f43eab8b Assign meaningful name to MemoryAccess. NFC
Now the name of MemoryAccess is <StatementName>_[Read|Write|MayWrite]<Number>_<BaseName>,
e.g. Stmt_for_body_4_Read0_MemRef_A

llvm-svn: 261401
2016-02-20 03:40:15 +00:00
Tobias Grosser 58e585444a Codegen: Print error in Polly code verification and allow to disable verfication.
We now always print the reason why the code did not pass the LLVM verifier and
we also allow to disable verfication with -polly-codegen-verify=false. Before
this change the first assertion had generally no information why or what might
have gone wrong and it was also impossible to -view-cfg without recompile. This
change makes debugging bugs that result in incorrect IR a lot easier.

llvm-svn: 261320
2016-02-19 11:07:12 +00:00
Johannes Doerfert 4d9bb8d594 Allow all combinations of types and subscripts for memory accesses
To support non-aligned accesses we introduce a virtual element size
  for arrays that divides each access function used for this array. The
  adjustment of the access function based on the element size of the
  array was therefore moved after this virtual element size was
  determined, thus after all accesses have been created.

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

llvm-svn: 261226
2016-02-18 16:50:12 +00:00
Hongbin Zheng a7bdd29c9c Add more isl object printing function
llvm-svn: 261216
2016-02-18 15:24:42 +00:00
Hongbin Zheng 0169ae8ed5 Add the missing __isl_give to MemoryAccess::getAccessRelation
llvm-svn: 261215
2016-02-18 15:24:38 +00:00
Hongbin Zheng 8831eb7db4 [Refactor] Move isl_ctx into Scop.
After we moved isl_ctx into Scop, we need to free the isl_ctx after
  freeing all isl objects, which requires the ScopInfo pass to be freed
  at last. But this is not guaranteed by the PassManager, and we need
  extra code to free the isl_ctx at the right time.

  We introduced a shared pointer to manage the isl_ctx, and distribute
  it to all analyses that create isl objects. As such, whenever we free
  an analyses with the shared_ptr (and also free the isl objects which
  are created by the analyses), we decrease the (shared) reference
  counter of the shared_ptr by 1. Whenever the reference counter reach
  0 in the releaseMemory function of an analysis, that analysis will
  be the last one that hold any isl objects, and we can safely free the
  isl_ctx with that analysis.

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

llvm-svn: 261100
2016-02-17 15:49:21 +00:00
Tobias Grosser a2ee003239 ScopDectect: Allow memory accesses with different element types by default (try 3)
First support for this feature was committed in r259784. Support for
loop invariant load hoisting with different types was added by
Johannes Doerfert in r260045 and r260886.

llvm-svn: 260965
2016-02-16 14:37:24 +00:00
Johannes Doerfert 2c3ffc04f3 Replace getLoopForInst by getLoopForStmt
This patch was extracted from http://reviews.llvm.org/D13611.

llvm-svn: 260958
2016-02-16 12:36:14 +00:00
Johannes Doerfert 6a7c3e4bac Set AST Build for all statements [NFC]
llvm-svn: 260956
2016-02-16 12:11:03 +00:00
Johannes Doerfert 13637678b1 [FIX] LICM test case
llvm-svn: 260955
2016-02-16 12:10:42 +00:00
Johannes Doerfert 4cf1580f0c [FIX] Check the next base pointer for possible invariant loads
A load can only be invariant if its base pointer is invariant too. To
  this end, we check if the base pointer is defined inside the region or
  outside. In the former case we recursively check if we can (and
  therefore will) hoist the base pointer too. Only if that happends we
  can hoist the load.

llvm-svn: 260886
2016-02-15 12:42:05 +00:00
Johannes Doerfert f69162486b Revert "[FIX] Hoist accesses if AA stated they are invariant"
This reverts commit 98efa006c96ac981c00d2e386ec1102bce9f549a.

  The fix was broken since we do not use AA in the ScopDetection anymore to
  check for invariant accesses.

llvm-svn: 260884
2016-02-15 12:21:11 +00:00
Hongbin Zheng 226232044a [Refactor] Eliminate the global variable "InsnToMemAcc".
Eliminate the global variable "InsnToMemAcc" to make Scop/ScopInfo become
  more protable, such that we can safely use them in a CallGraphSCC pass.

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

llvm-svn: 260863
2016-02-15 00:20:58 +00:00
Johannes Doerfert 2353e39e1f [FIX] Hoist accesses if AA stated they are invariant
Before this patch it could happen that we did not hoist a load that
  was a base pointer of another load even though AA already declared the
  first one as invariant (during ScopDetection). If this case arises we
  will now skipt the "can be overwriten" check because in this case the
  over-approximating nature causes us to generate broken code.

llvm-svn: 260862
2016-02-14 23:37:14 +00:00
Johannes Doerfert 3ff2221cfc Split ScopArrayInfo::updateSizes into two functions
The former ScopArrayInfo::updateSizes was implicitly divided into an
  updateElementType and an updateSizes. Now this partitioning is
  explicit.

llvm-svn: 260860
2016-02-14 22:31:39 +00:00
Johannes Doerfert 965edde695 Separate more constant factors of parameters
So far we separated constant factors from multiplications, however,
  only when they are at the outermost level of a parameter SCEV. Now,
  we also separate constant factors from the parameter SCEV if the
  outermost expression is a SCEVAddRecExpr. With the changes to the
  SCEVAffinator we can now improve the extractConstantFactor(...)
  function at will without worrying about any other code part. Thus,
  if needed we can implement a more comprehensive
  extractConstantFactor(...) function that will traverse the SCEV
  instead of looking only at the outermost level.

  Four test cases were affected. One did not change much and the other
  three were simplified.

llvm-svn: 260859
2016-02-14 22:30:56 +00:00
Tobias Grosser 652f780894 CodeGeneration: Add back verification of generated code
This got accidentally dropped in r260025

llvm-svn: 260857
2016-02-14 20:56:49 +00:00
Tobias Grosser 5e27ec33ea Revert "[ScopDectect] Allow memory accesses with different element types by default"
This reverts commit https://llvm.org/svn/llvm-project/polly/trunk@260853

We unfortunately still have two bugs left which show only up with
-polly-process-unprofitable and which I forgot to test before committing.

llvm-svn: 260854
2016-02-14 19:59:29 +00:00
Tobias Grosser 5f105f9bdd [ScopDectect] Allow memory accesses with different element types by default
First support for this feature was committed in r259784. Support for
loop invariant load hoisting with different types was added by Johannes
Doerfert in r260045. This fixed the last known bug.

llvm-svn: 260853
2016-02-14 19:11:16 +00:00
Hongbin Zheng fec328083a Use unique_ptr to manage Scop inside ScopInfo.
llvm-svn: 260821
2016-02-13 15:13:02 +00:00
Hongbin Zheng 660f3ccfa5 Move AccFuncMap from ScopInfo into Scop
Since the origin AccFuncMap in ScopInfo is used by the underlying Scop
  only, and it must stay alive until we delete the Scop. It will be better
  if we simply move the origin AccFuncMap in ScopInfo into the Scop class.

llvm-svn: 260820
2016-02-13 15:12:58 +00:00
Hongbin Zheng 192f69a0fb Do not carry LoopInfo along with a Scop.
Make Scop become more portable such that we can use it in a CallGraphSCC pass.
  The first step is to drop the analyses that are only used during Scop construction.
  This patch drop LoopInfo from Scop.

llvm-svn: 260819
2016-02-13 15:12:54 +00:00
Hongbin Zheng f53ffa6dc3 Do not carry DominatorTree along with a Scop.
Make Scop become more portable such that we can use it in a CallGraphSCC pass.
  The first step is to drop the analyses that are only used during Scop construction.
  This patch drop DominatorTree from Scop.

llvm-svn: 260818
2016-02-13 15:12:51 +00:00
Hongbin Zheng 7dddfba7dc Do not carry ScopDetection along with a Scop.
Make Scop become more portable such that we can use it in a CallGraphSCC pass.
  The first step is to drop the analyses that are only used during Scop construction.
  This patch drop ScopDecection from Scop.

llvm-svn: 260817
2016-02-13 15:12:47 +00:00
Johannes Doerfert 96e5471139 Separate invariant equivalence classes by type
We now distinguish invariant loads to the same memory location if they
  have different types. This will cause us to pre-load an invariant
  location once for each type that is used to access it. However, we can
  thereby avoid invalid casting, especially if an array is accessed
  though different typed/sized invariant loads.

  This basically reverts the changes in r260023 but keeps the test
  cases.

llvm-svn: 260045
2016-02-07 17:30:13 +00:00
Johannes Doerfert e708790c59 [FIX] Two "off-by-one" error in constant range usage
llvm-svn: 260031
2016-02-07 13:59:03 +00:00
Johannes Doerfert adeab372ca Simplify code [NFC]
llvm-svn: 260030
2016-02-07 13:57:32 +00:00
Tobias Grosser 8ebdc2dd53 Make memory accesses with different element types optional
We also disable this feature by default, as there are still some issues in
combination with invariant load hoisting that slipped through my initial
testing.

llvm-svn: 260025
2016-02-07 08:48:57 +00:00
Tobias Grosser 46bafbd0fe Do not yet consider loads with non-canonical element size for load hoisting.
Invariant load hoisting of memory accesses with non-canonical element
types lacks support for equivalence classes that contain elements of
different width/size. This support should be added, but to get our buildbots
back to green, we disable load hoisting for memory accesses with non-canonical
element size for now.

llvm-svn: 260023
2016-02-07 08:11:36 +00:00
Tobias Grosser 107cd5f5f6 IslNodeBuilder: Invariant load hoisting of elements with differing sizes
Always use access-instruction pointer type to load the invariant values.
Otherwise mismatches between ScopArrayInfo element type and memory access
element type will result in invalid casts. These type mismatches are after
r259784 a lot more common and also arise with types of different size, which
have not been handled before.

Interestingly, this change actually simplifies the code, as we now have only
one code path that is always taken, rather then a standard code path for the
common case and a "fixup" code path that replaces the standard code path in
case of mismatching types.

llvm-svn: 260009
2016-02-06 21:23:39 +00:00
Michael Kruse 2e02d560aa Follow uses to create value MemoryAccesses
The previously implemented approach is to follow value definitions and
create write accesses ("push defs") while searching for uses. This
requires the same relatively validity- and requirement conditions to be
replicated at multiple locations (PHI instructions, other instructions,
uses by PHIs).

We replace this by iterating over the uses in a SCoP ("pull in
requirements"), and add writes only when at least one read has been
added. It turns out to be simpler code because each use is only iterated
over once and writes are added for the first access that reads it. We
need another iteration to identify escaping values (uses not in the
SCoP), which also makes the difference between such accesses more
obvious. As a side-effect, the order of scalar MemoryAccess can change.

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

llvm-svn: 259987
2016-02-06 09:19:40 +00:00
Tobias Grosser d840fc7277 Support accesses with differently sized types to the same array
This allows code such as:

void multiple_types(char *Short, char *Float, char *Double) {
  for (long i = 0; i < 100; i++) {
    Short[i] = *(short *)&Short[2 * i];
    Float[i] = *(float *)&Float[4 * i];
    Double[i] = *(double *)&Double[8 * i];
  }
}

To model such code we use as canonical element type of the modeled array the
smallest element type of all original array accesses, if type allocation sizes
are multiples of each other. Otherwise, we use a newly created iN type, where N
is the gcd of the allocation size of the types used in the accesses to this
array. Accesses with types larger as the canonical element type are modeled as
multiple accesses with the smaller type.

For example the second load access is modeled as:

  { Stmt_bb2[i0] -> MemRef_Float[o0] : 4i0 <= o0 <= 3 + 4i0 }

To support code-generating these memory accesses, we introduce a new method
getAccessAddressFunction that assigns each statement instance a single memory
location, the address we load from/store to. Currently we obtain this address by
taking the lexmin of the access function. We may consider keeping track of the
memory location more explicitly in the future.

We currently do _not_ handle multi-dimensional arrays and also keep the
restriction of not supporting accesses where the offset expression is not a
multiple of the access element type size. This patch adds tests that ensure
we correctly invalidate a scop in case these accesses are found. Both types of
accesses can be handled using the very same model, but are left to be added in
the future.

We also move the initialization of the scop-context into the constructor to
ensure it is already available when invalidating the scop.

Finally, we add this as a new item to the 2.9 release notes

Reviewers: jdoerfert, Meinersbur

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

llvm-svn: 259784
2016-02-04 13:18:42 +00:00
Tobias Grosser dae306d2e4 ScopInfo: Improve documentation of ScopArrayInfo
This adds more information about how dimensions are incrementally updated and
what exactly the canonical element type is.

llvm-svn: 259772
2016-02-04 09:27:34 +00:00
Tobias Grosser a91684d554 Add 3.9 release notes document
llvm-svn: 259768
2016-02-04 08:10:29 +00:00
Tobias Grosser 719f843e67 Add 'Using Polly with Clang' to Spinx
llvm-svn: 259767
2016-02-04 07:45:32 +00:00
Tobias Grosser d7ccafe35f Add Sphinx configuration
This just adds the basic configuration with an empty index/welcome page

llvm-svn: 259765
2016-02-04 07:27:57 +00:00
Tobias Grosser b6948c1289 Add basic doxygen infrastructure for Polly
llvm-svn: 259764
2016-02-04 07:16:36 +00:00
Tobias Grosser 2a969e043a www: Remove some spaces
llvm-svn: 259761
2016-02-04 06:41:03 +00:00
Tobias Grosser 0ef8fa2528 www: Add Michael's thesis
llvm-svn: 259760
2016-02-04 06:40:59 +00:00
Tobias Grosser b9d4b24624 www: Add Felix-Antoine's master thesis
llvm-svn: 259759
2016-02-04 06:36:50 +00:00
Tobias Grosser 71c250445a www: Drop outdated dragonegg documentation
Even though the commands still work, dragonegg has not been updated to work with
recent versions of LLVM. Consequently, only very old Polly versions (which we
do not support any more), can be used in this way.

This simplifies our documentation page.

llvm-svn: 259758
2016-02-04 06:23:53 +00:00
Tobias Grosser a7f1e04031 Update to isl-0.16.1-20-gee54b48
This includes some (optional) improvements to the isl scheduler, which we do not
use yet, as well as a fix for a bug previously also affecting Polly:

commit 662ee9b7d45ebeb7629b239d3ed43442e25bf87c
Author: Sven Verdoolaege <skimo@kotnet.org>
Date:   Mon Jan 25 16:59:32 2016 +0100

    isl_basic_map_realign: perform Gaussian elimination on result

    Many parts of isl assume that Gaussian elimination has been
    applied to the equality constraints.  In particular singleton_extract_point
    makes this assumption.  The input to singleton_extract_point
    may have undergone parameter alignment.  This parameter alignment
    (ultimately performed by isl_basic_map_realign) therefore
    needs to make sure the result preserves this property

llvm-svn: 259757
2016-02-04 06:19:12 +00:00
Wei Mi eb14ac5396 Polly tests update contributed by Tobias Grosser for SCEV patch in r259736.
llvm-svn: 259737
2016-02-04 01:34:28 +00:00
Tobias Grosser ba043143a9 test: make test case more robust against removal of unrelated instructions
llvm-svn: 259693
2016-02-03 21:10:11 +00:00
Tobias Grosser bea6c54723 Properly build shared libraries if LLVM_LINK_LLVM_DYLIB is enabled.
Contributed-by: Jack Howarth <howarthjw@gmail.com>
llvm-svn: 259659
2016-02-03 16:29:04 +00:00
Tobias Grosser 05514e4d7f www: Simplify 'build & install' descriptions
We remove information for older versions of Polly and also shorten the overall
text. This should make it a lot easier for people to get to the important code
wight away.

llvm-svn: 259658
2016-02-03 16:18:24 +00:00
Tobias Grosser 23aea0d5d0 tScopInfo: Shorten comment slightly
llvm-svn: 259653
2016-02-03 15:42:38 +00:00
Tobias Grosser f4a97d0772 ScopInfo: Extend description of the access relation.
llvm-svn: 259633
2016-02-03 06:37:38 +00:00
Tobias Grosser e2c31210b2 Revert "Support loads with differently sized types from a single array"
This reverts commit (@259587). It needs some further discussions.

llvm-svn: 259629
2016-02-03 05:53:27 +00:00
Tobias Grosser 5d3fc1ea43 Support loads with differently sized types from a single array
We support now code such as:

void multiple_types(char *Short, char *Float, char *Double) {
  for (long i = 0; i < 100; i++) {
    Short[i] = *(short *)&Short[2 * i];
    Float[i] = *(float *)&Float[4 * i];
    Double[i] = *(double *)&Double[8 * i];
  }
}

To support such code we use as element type of the modeled array the smallest
element type of all original array accesses. Accesses with larger types are
modeled as multiple accesses with the smaller type.

For example the second load access is modeled as:

  { Stmt_bb2[i0] -> MemRef_Float[o0] : 4i0 <= o0 <= 3 + 4i0 }

To support jscop-rewritable memory accesses we need each statement instance to
only be assigned a single memory location, which will be the address at which
we load the value. Currently we obtain this address by taking the lexmin of
the access function. We may consider keeping track of the memory location more
explicitly in the future.

llvm-svn: 259587
2016-02-02 22:05:29 +00:00
Tobias Grosser db543ede7e ScopInfo: Split memory access construction into different cases
We create separate functions for fixed-size multi-dimensional, parameteric-sized
multi-dimensional, as well as single-dimensional memory accesses to reduce the
complexity of a large monolithic function.

Suggested-by: Michael Kruse <llvm@meinersbur.de>
llvm-svn: 259522
2016-02-02 16:46:49 +00:00
Tobias Grosser 5d51afedd8 ScopInfo: Do not track element-size as additional array size dimension [NFC]
There is no need to pass the size of the elements as the last size dimension
to ScopArrayInfo. This information is already available through the ElementType.
Tracking it twice is not only redundant but may result in inconsistencies.

llvm-svn: 259521
2016-02-02 16:46:45 +00:00
Johannes Doerfert 7c38b3296b [WWW] Add our Polly/OpenCL paper
llvm-svn: 259511
2016-02-02 15:03:31 +00:00
Johannes Doerfert 46d771c93f Remove unneeded definition [NFC]
llvm-svn: 259505
2016-02-02 14:16:22 +00:00
Johannes Doerfert 800e17a75c Add const keyword to MemoryAccess argument [NFC]
llvm-svn: 259504
2016-02-02 14:16:01 +00:00
Johannes Doerfert e0de09682e Sort analysis members and unifiy documentation [NFC]
llvm-svn: 259503
2016-02-02 14:15:37 +00:00
Johannes Doerfert a1f291ed18 Rename the DataLayout member [NFC]
llvm-svn: 259502
2016-02-02 14:15:13 +00:00
Johannes Doerfert a87810351c Remove helper function [NFC]
llvm-svn: 259501
2016-02-02 14:14:40 +00:00
Johannes Doerfert c36d39b7a8 Remove unnecessary getAnalysis call [NFC]
llvm-svn: 259500
2016-02-02 14:14:20 +00:00
Tobias Grosser cc77950b2b ScopInfo: Rename AccessType -> ElementType to unify naming with method declaration
llvm-svn: 259495
2016-02-02 13:22:54 +00:00
Tobias Grosser f5e239c4c3 www: Mark full/partial tile separation for vectorization as 'done'
Roman contributed this

llvm-svn: 259486
2016-02-02 09:55:59 +00:00
Tobias Grosser 0720570eee www: Update statistic code
llvm-svn: 259485
2016-02-02 09:55:55 +00:00
Tobias Grosser 6c2ae4592d www: update formatting of polyhedral.info news
llvm-svn: 259483
2016-02-02 09:30:01 +00:00
Tobias Grosser 542625eb6e www: Fix overlapping lines II
llvm-svn: 259477
2016-02-02 08:49:34 +00:00
Tobias Grosser 0dcafe94f8 Avoid overlapping lines
llvm-svn: 259476
2016-02-02 08:47:56 +00:00
Tobias Grosser c2fd8b411d ScopInfo: Correct schedule construction
For schedule generation we assumed that the reverse post order traversal used by
the domain generation is sufficient, however it is not. Once a loop is
discovered, we have to completely traverse it, before we can generate the
schedule for any block/region that is only reachable through a loop exiting
block.

To this end, we add a "loop stack" that will keep track of loops we
discovered during the traversal but have not yet traversed completely.
We will never visit a basic block (or region) outside the most recent
(thus smallest) loop in the loop stack but instead queue such blocks
(or regions) in a waiting list. If the waiting list is not empty and
(might) contain blocks from the most recent loop in the loop stack the
next block/region to visit is drawn from there, otherwise from the
reverse post order iterator.

We exploit the new property of loops being always completed before additional
loops are processed, by removing the LoopSchedules map and instead keep all
information in LoopStack. This clarifies that we indeed always only keep a
stack of in-process loops, but will never keep incomplete schedules for an
arbitrary set of loops. As a result, we can simplify some of the existing code.

This patch also adds some more documentation about how our schedule construction
works.

This fixes http://llvm.org/PR25879

This patch is an modified version of Johannes Doerfert's initial fix.

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

llvm-svn: 259354
2016-02-01 11:54:13 +00:00
Tobias Grosser ccbe383594 ScopInfo: Drop dead code in schedule description
In https://llvm.org/svn/llvm-project/polly/trunk@251870 code was committed to
avoid a failure in the presence of infinite loops, but the test case committed
along with this change passes without the actual change. I looked back into the
code and also checked with the original committer (Johannes), but could not find
the reason why the code is needed. The introduction of LoopStacks for
buildSchedule in one of the next commits will make it even more clear that this
code is not needed, but I remove this ahead of time to facilitate bisecting in
case I missed something.

llvm-svn: 259347
2016-02-01 10:07:43 +00:00
Tobias Grosser 0dd4a9a9f4 ScopInfo: use std::distance to shorten code [NFC]
llvm-svn: 259337
2016-02-01 01:55:08 +00:00
Craig Topper 7fb6e47101 Replace utostr_32 use with utostr to match removal from llvm.
llvm-svn: 259333
2016-01-31 20:36:20 +00:00
Tobias Grosser ed873cd3c1 cmake: Add additional libraries to fix the darwin shared library build
darwin requires the additional linkages of...

LLVMBitReader
LLVMMCParser
LLVMObject
LLVMProfileData
LLVMTarget
LLVMVectorize

as the darwin requires all of the weak undefined symbols in a library to be
resolved when linking it against an executable (unless
-Wl,-undefined,dynamic_lookup is used to override the default behavior of
-Wl,-undefined,error).

Contributed-by: Jack Howarth
llvm-svn: 259332
2016-01-31 20:25:46 +00:00
Michael Kruse 26311f00e8 Remove autotools build system
The autotools build system is based on and requires LLVM's autotools
build system to work, which has been depricated and finally removed in
r258861. Consequently we also remove the autotools build system from
Polly.

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

llvm-svn: 259041
2016-01-28 12:00:33 +00:00
Michael Kruse fd46308de4 ScopInfo: Never add read accesses for synthesizable values
Before adding a MK_Value READ MemoryAccess, check whether the read is
necessary or synthesizable. Synthesizable values are later generated by
the SCEVExpander and therefore do not need to be transferred
explicitly. This can happen because the check for synthesizability has
presumbly been forgotten in the case where a phi's incoming value has
been defined in a different statement.

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

llvm-svn: 258998
2016-01-27 22:51:56 +00:00
Michael Kruse 70131d3416 Introduce MemAccInst helper class; NFC
MemAccInst wraps the common members of LoadInst and StoreInst. Also use
of this class in:
- ScopInfo::buildMemoryAccess
- BlockGenerator::generateLocationAccessed
- ScopInfo::addArrayAccess
- Scop::buildAliasGroups
- Replace every use of polly::getPointerOperand

Reviewers: jdoerfert, grosser

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

llvm-svn: 258947
2016-01-27 17:09:17 +00:00
Michael Kruse ee6a4fc680 Unique phi write accesses
Ensure that there is at most one phi write access per PHINode and
ScopStmt. In particular, this would be possible for non-affine
subregions with multiple exiting blocks. We replace multiple MAY_WRITE
accesses by one MUST_WRITE access. The written value is constructed
using a PHINode of all exiting blocks. The interpretation of the PHI
WRITE's "accessed value" changed from the incoming value to the PHI like
for PHI READs since there is no unique incoming value.

Because region simplification shuffles around PHI nodes -- particularly
with exit node PHIs -- the PHINodes at analysis time does not always
exist anymore in the code generation pass. We instead remember the
incoming block/value pair in the MemoryAccess.

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

llvm-svn: 258809
2016-01-26 13:33:27 +00:00
Michael Kruse ad28e5a589 Unique value read accesses
Keep at most one value read MemoryAccess per value and statement;
multiple generated loads do not have any additional effect. As one such
MemoryAccess can cater multiple uses within the statement, the
AccessInstruction property is not unique any more and set to nullptr.

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

llvm-svn: 258808
2016-01-26 13:33:15 +00:00
Michael Kruse 436db620e7 Unique value write accesses
Ensure there is at most one write access per definition of an
llvm::Value. Keep track of already created value write access by using
a (dense) map.

Replace addValueWriteAccess by ensureValueStore which can be uses more
liberally without worrying to add redundant accesses. It will be used,
e.g. in a logical correspondant for value reads -- ensureValueReload --
to ensure that the expected definition has been written when loading it.

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

llvm-svn: 258807
2016-01-26 13:33:10 +00:00
Johannes Doerfert 6f50c29ab2 [FIX] Domain generation error due to loops in non-affine regions
llvm-svn: 258803
2016-01-26 11:03:25 +00:00
Johannes Doerfert 432658d7b8 [FIX] Build correct domain for non-affine region SCoPs
llvm-svn: 258802
2016-01-26 11:01:41 +00:00
Tobias Grosser f2cdd144e5 BlockGenerators: Replace getNewScalarValue with getNewValue
Both functions implement the same functionality, with the difference that
getNewScalarValue assumes that globals and out-of-scop scalars can be directly
reused without loading them from their corresponding stack slot. This is correct
for sequential code generation, but causes issues with outlining code e.g. for
OpenMP code generation. getNewValue handles such cases correctly.

Hence, we can replace getNewScalarValue with getNewValue. This is not only more
future proof, but also eliminates a bunch of code.

The only functionality that was available in getNewScalarValue that is lost
is the on-demand creation of scalar values. However, this is not necessary any
more as scalars are always loaded at the beginning of each basic block and will
consequently always be available when scalar stores are generated. As this was
not the case in older versions of Polly, it seems the on-demand loading is just
some older code that has not yet been removed.

Finally, generateScalarLoads also generated loads for values that are loop
invariant, available in GlobalMap and which are preferred over the ones loaded
in generateScalarLoads. Hence, we can just skip the code generation of such
scalar values, avoiding the generation of dead code.

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

llvm-svn: 258799
2016-01-26 10:01:35 +00:00
Tobias Grosser 232905089e test: Name instructions in a test case [NFC]
llvm-svn: 258662
2016-01-24 17:51:37 +00:00
Tobias Grosser 5c7f16be6b BlockGenerators: Avoid redundant map lookup [NFC]
llvm-svn: 258660
2016-01-24 14:16:59 +00:00
Tobias Grosser c9abde8c51 ScopInfo: Simplify code by folding definition into if
llvm-svn: 258632
2016-01-23 20:23:06 +00:00
Tobias Grosser 1c3a6d7808 ScopDetection: Do not detect regions with irreducible control as scops
Polly currently does not support irreducible control and it is probably not
worth supporting. This patch adds code that checks for irreducible control
and refuses regions containing irreducible control.

Polly traditionally had rather restrictive checks on the control flow structure
which would have refused irregular control, but within the last couple of months
most of the control flow restrictions have been removed. As part of this
generalization we accidentally allowed irregular control flow.

Contributed-by: Karthik Senthil and Ajith Pandel
llvm-svn: 258497
2016-01-22 09:44:37 +00:00
Tobias Grosser b3a9538e95 Remove irreducible control flow from test case
The test case we look at does not necessarily require irreducible control flow,
but a normal loop is sufficient to create a non-affine region containing more
than one basic block that dominates the exit node. We replace this irreducible
control flow with a normal loop for the following reasons:

  1) This is easier to understand
  2) We will subsequently commit a patch that ensures Polly does not process
     irreducible control flow.

Within non-affine regions, we could possibly handle irreducible control flow.

llvm-svn: 258496
2016-01-22 09:33:33 +00:00
Tobias Grosser 40038d2d1e www: Update links to LLVM bug tracker
Polly recently got its own product in LLVM's bug tracker, which will make it
easier for people to file Polly bugs. This change updates the bugtracker links
on the Polly website.

llvm-svn: 258494
2016-01-22 08:19:54 +00:00
Sumanth Gundapaneni 4b1472fb2b Fix the error in non-asserts Release mode build. NFC
llvm-svn: 258318
2016-01-20 15:41:30 +00:00
Johannes Doerfert 370cf00c9f Make sure we preserve alignment information after hoisting invariant load
In Polly, after hoisting loop invariant loads outside loop, the alignment
information for hoisted loads are missing, this patch restore them.

Contributed-by: Lawrence Hu <lawrence@codeaurora.org>

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

llvm-svn: 258105
2016-01-19 00:17:21 +00:00
Michael Kruse dc8508e72a Do not check JSON alignment of scalar accesses
When importing a schedule, do not verify the load/store alignment of
scalar accesses. Scalar loads/store are always created newly in code
generation with no alignment restrictions. Previously, scalar alignment
was checked if the access instruction happened to be a LoadInst or
StoreInst, but only its array (MK_Array) access is relevant.

This will be implicitly unit-tested when the access instruction of a
value read can be nullptr.

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

llvm-svn: 257904
2016-01-15 16:49:33 +00:00
Michael Kruse 959a8dc39f Update to ISL 0.16.1
llvm-svn: 257898
2016-01-15 15:54:45 +00:00
Michael Kruse f7d5e40860 Add option to update-isl.sh for specific commit
This is used e.g. to update specifically to ISL 0.16.1 although newer
revisions exist in the official repository.

llvm-svn: 257895
2016-01-15 15:41:59 +00:00
Michael Kruse 5a9a65e43f Prepare unit tests for update to ISL 0.16
ISL 0.16 will change how sets are printed which breaks 117 unit tests
that text-compare printed sets. This patch re-formats most of these unit
tests using a script and small manual editing on top of that. When
actually updating ISL, most work is done by just re-running the script
to adapt to the changed output.

Some tests that compare IR and tests with single CHECK-lines that can be
easily updated manually are not included here.

The re-format script will also be committed afterwards. The per-test
formatter invocation command lines options will not be added in the near
future because it is ad hoc and would overwrite the manual edits.
Ideally it also shouldn't be required anymore because ISL's set printing
has become more stable in 0.16.

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

llvm-svn: 257851
2016-01-15 00:48:42 +00:00
Roman Gareev b0c4e49a37 Fix of r257495.
Remove redundant "FPM->add(createDemoteRegisterToMemoryPass());"

llvm-svn: 257514
2016-01-12 20:47:48 +00:00
Roman Gareev 6ebc01c973 We do not need to schedule another loop interchange pass after Polly, as Polly
should perform loop interchanges itself.

This also fixes a bug we see due to the "loop-interchange" pass producing
incorrect IR when compiling linpack-pc.c from the LLVM test-suite with
"-polly-position=before-vectorizer".

Reviewed-by: Tobias Grosser <tobias@grosser.es>
llvm-svn: 257495
2016-01-12 17:59:06 +00:00
Roman Gareev 10595a1739 Call assumeNoOutOfBound only in updateDimensionality
Call assumeNoOutOfBound only in updateDimensionality to process situations
when new dimensions are added and new bounds checks are required.

Contributed-by: Tobias Grosser, Gareev Roman
llvm-svn: 257170
2016-01-08 14:01:59 +00:00
Tobias Grosser 8362c26113 Define buildScheduleRec on RegionNodes and pull out the tree traversal [NFC]
This change clarifies that for Not-NonAffine-SubRegions we actually iterate over
the subnodes and for both NonAffine-SubRegions and BasicBlocks, we perform the
schedule construction. As a result, the tree traversal becomes trivial, the
special case for a scop consisting just of a single non-affine region
disappears and the indentation of the code is reduced.

No functional change intended.

llvm-svn: 256940
2016-01-06 15:30:06 +00:00
Johannes Doerfert f9711ef922 Extract constant parts of the schedule generation [NFC]
llvm-svn: 256931
2016-01-06 12:59:23 +00:00
Tobias Grosser 05e71b9f61 ScopInfo: use getStmtForRegionNode to simplify code slightly
llvm-svn: 256914
2016-01-06 05:18:20 +00:00
Tobias Grosser c28ae257c0 TODO: Polly can handle boolean expressions (Open->Done)
The necessary support was committed by Johannes in r249971.

llvm-svn: 256826
2016-01-05 11:48:59 +00:00
Tobias Grosser 100ef6b30c TODO: We do not use -independent-blocks any more (Open -> Done)
llvm-svn: 256825
2016-01-05 11:45:26 +00:00
Tobias Grosser ce9ef39c10 IslExprBuilder: Provide PointerLikeTypeTraits for isl_id
Providing an explicit PointerLikeTypeTraits implementation became necessary
since LLVM started in https://llvm.org/svn/llvm-project/llvm/trunk@256620
to automatically derive the pointer alignment from the pointer element type,
which does not work for incomplete types as used by isl. To ensure our code
still compiles, we provide an instantiation of PointerLikeTypeTraits for isl_id
which assumes no minimal alignment. isl pointers are likely to have a "higher"
alignment. We can exploit this later in case this becomes performance relevant.

llvm-svn: 256650
2015-12-30 20:11:48 +00:00
Tobias Grosser 5a90a985b9 ScopDetection: Add include to make complete type of llvm::Region available
This is necessary for the recent ptr-traits work in LLVM, which now requires
complete type definitions.

llvm-svn: 256649
2015-12-30 20:11:43 +00:00
Michael Kruse 58fa3bb63a Do not store scalar accesses in InstructionToAccess
At code generation, scalar reads are generated before the other
statement's instructions, respectively scalar writes after them, in
contrast to array accesses which are "executed" with the instructions
they are linked to. Therefore it makes sense to not map the scalar
accesses to a place of execution. Follow-up patches will also remove
some of the directs links from a scalar access to a single instruction,
such that only having array accesses in InstructionToAccess ensures
consistency.

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

llvm-svn: 256298
2015-12-22 23:25:11 +00:00
Johannes Doerfert 5dced2693e Refactor canSynthesize in the BlockGenerators [NFC]
llvm-svn: 256269
2015-12-22 19:08:49 +00:00
Johannes Doerfert 28f8ac1db2 Treat inline assembly as a constant in the code generation.
llvm-svn: 256267
2015-12-22 19:08:24 +00:00
Johannes Doerfert 42df8d1db6 Reduce indention in BlockGenerator::trySynthesizeNewValue [NFC]
llvm-svn: 256266
2015-12-22 19:08:01 +00:00
Tobias Grosser c6424ae46c ScopDetection: Simplify std::distance(....) to BB->size()
Suggested by: Johannes Doerfert <doerfert@cs.uni-saarland.de>

llvm-svn: 256260
2015-12-22 17:38:59 +00:00
Tobias Grosser fcabb155c1 BlockGenerators: Remove unnecessary const_cast
llvm-svn: 256227
2015-12-22 01:41:25 +00:00
Tobias Grosser c900633d60 ScopInfo: Small improvement to schedule construction [NFC]
We clarify that certain code is only executed if LSchedule is != nullptr.
Previously some of these functions have been executed, but they only passed
a nullptr through. This caused some confusion when reading the code.

llvm-svn: 256209
2015-12-21 23:01:53 +00:00
Tobias Grosser cbf7ae8fef ScopInfo: Polish the implementation of mapToDimension
Besides improving the documentation and the code we now assert in case the input
is invalid (N < 0) and also do not any more return a nullptr in case USet is
empty. This should make the code more readable.

llvm-svn: 256208
2015-12-21 22:45:53 +00:00
Tobias Grosser c1a269bf0e Add option to assume single-loop scops with sufficient compute are profitable
If a loop has a sufficiently large amount of compute instruction in its loop
body, it is unlikely that our rewrite of the loop iterators introduces large
performance changes. As Polly can also apply beneficical optimizations (such
as parallelization) to such loop nests, we mark them as profitable.

This option is currently "disabled" by default, but can be used to run
experiments. If enabled by setting it e.g. to 40 instructions, we currently
see some compile-time increases on LNT without any significant run-time
changes.

llvm-svn: 256199
2015-12-21 21:00:43 +00:00
Tobias Grosser 5624d3c978 Adjust formatting to clang-format changes in 256149
llvm-svn: 256151
2015-12-21 12:38:56 +00:00
Tobias Grosser 97fc5bb7f7 ScopDetect: Extract profitability check into subfunction
.. and add some documentation. We also simplify the code by dropping an early
check that is also covered by the the later checks. This might have a small
compile time impact, but as the scops that are skipped are small we should
probably only add this back in the unlikely case that this has a notable
compile-time cost.

No functional change intended.

llvm-svn: 256149
2015-12-21 12:14:48 +00:00
Tobias Grosser 594882573e ScopInfo: Return immediately if scop is unprofitable and marked invalid
As we already log an error when calling invalid, scops unprofitable scops are in
any case marked invalid, but returning immediately safes (a tiny bit of) compile
time and is consistent with our use of 'invalid' in the remainder of the file.

Found by inspection.

llvm-svn: 256140
2015-12-21 09:09:44 +00:00
Tobias Grosser bfaf1ae309 ScopInfo: Return in case we found an invalid array size
Without this return we still log the incorrect array size (and do not detect
this scop), but we would unnecessarily continue to verify that access functions
are affine. As we do not need to do this, we can return right ahead and
consequently safe compile time.

This issue was found by inspection.

llvm-svn: 256139
2015-12-21 09:09:39 +00:00
Tobias Grosser 949e8c6ac6 ScopInfo: Check for the existance of a single memory accesses
Instead of counting all array memory accesses associated with a load
instruction, we now explicitly check that the single array access that could
(potentially) be associated with a load instruction does not exist. This helps
to document the current behavior of Polly where load instructions can indeed
have at most one associated array access. In the unlikely case this changes
in the future, we add an assert for the case where two load accesses would
prevent us to return a single memory access, but we still should communicate
that not all array memory accesses have been removed.

This addresses post-commit comments from Johannes Doerfert for commit 255776.

llvm-svn: 256136
2015-12-21 07:10:39 +00:00
Johannes Doerfert 30e2307f61 [FIX] Schedule generation for block exiting multiple loops.
This fixes bug PR25604.

llvm-svn: 256125
2015-12-20 17:12:22 +00:00
Michael Kruse 8fc2896ee0 Compile fix: Use "&&" operator instead of "and"
llvm-svn: 256124
2015-12-20 14:42:32 +00:00
Tobias Grosser 75dc40c3be ScopInfo: Bail out in case of complex branch structures
Scops that contain many complex branches are likely to result in complex domain
conditions that consist of a large (> 100) number of conjucts.  Transforming
such domains is expensive and unlikely to result in efficient code.  To avoid
long compile times we detect this case and skip such scops. In the future we may
improve this by either using non-affine subregions to hide such complex
condition structures or by exploiting in certain cases properties (e.g.,
dominance) that allow us to construct the domains of a scop in a way that
results in a smaller number improving conjuncts.

Example of a code that results in complex iteration spaces:

      loop.header
     /    |    \ \
   A0    A2    A4 \
     \  /  \  /    \
      A1    A3      \
     /  \  /  \     |
   B0    B2    B4   |
     \  /  \  /     |
      B1    B3      ^
     /  \  /  \     |
   C0    C2    C4   |
     \  /  \  /    /
      C1    C3    /
       \   /     /
    loop backedge

llvm-svn: 256123
2015-12-20 13:31:48 +00:00
Roman Gareev 22803d4488 Fix of a comment.
llvm-svn: 255923
2015-12-17 20:47:10 +00:00
Roman Gareev 8aa437503c Fix delinearization of fortran arrays
The patch fixes Bug 25759 produced by inappropriate handling of unsigned
maximum SCEV expressions by SCEVRemoveMax. Without a fix, we get an infinite
loop and a segmentation fault, if we try to process, for example,
'((-1 + (-1 * %b1)) umax {(-1 + (-1 * %yStart)),+,-1}<%.preheader>)'.
It also fixes a potential issue related to signed maximum SCEV expressions.

Tested-by: Roman Gareev <gareevroman@gmail.com>
Fixed-by: Tobias Grosser <tobias@grosser.es>

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

llvm-svn: 255922
2015-12-17 20:37:17 +00:00
Tobias Grosser deb4abb409 Fix formatting
llvm-svn: 255892
2015-12-17 13:04:30 +00:00
Tobias Grosser eb2eebe486 ScopGraphPrinter: Only show functions that contain at least one scop
When running 'clang -O3 -mllvm -polly -mllvm -polly-show' we now only show the
CFGs of functions with at least one detected scop. For larger files/projects
this reduces the number of graphs printed significantly and is likely what
developers want to see. The new option -polly-view-all enforces all graphs to be
printed and the exiting option -poll-view-only limites the graph printing to
functions that match a certain pattern.

This patch requires https://llvm.org/svn/llvm-project/llvm/trunk@255889 (and
vice versa) to compile correctly.

llvm-svn: 255891
2015-12-17 12:55:26 +00:00
Tobias Grosser 10120189ab ScopInfo: Directly store MemoryAccessList in InstructionToAccess
This avoids the need for explicit memory management, simplifies the code and
also fixes a memory leak in removeMemoryAccesses.

llvm-svn: 255777
2015-12-16 16:14:03 +00:00
Tobias Grosser 2ed317383b ScopInfo: Introduce getNumberOfArrayAccesses
Use the new function to clarify that we indeed only want to know it at least
one array access is associated with an instruction.

llvm-svn: 255776
2015-12-16 16:14:00 +00:00
Tobias Grosser 04d4964462 ScopInfo: Delete code that has been made dead by previous commits
In case this functionality is needed in later patches, it should probably be
(re)added by these patches.

llvm-svn: 255717
2015-12-15 23:50:09 +00:00
Tobias Grosser 35ec5fbb8c ScopInfo: Use getArrayAccessFor in reduction detection
Load instructions may possibly be related to multiple memory accesses, but we
are only interested in the array read access that describes the memory location
the load instructions loads from. By using getArrayAccessfor we ensure to always
obtain the right memory access.

This issue was found by inspection without having a failing test case.

llvm-svn: 255716
2015-12-15 23:50:04 +00:00
Tobias Grosser 184a4926b3 BlockGenerator: Use getArrayAccessFor for vector code generation
getAccessFor does not guarantee a certain access to be returned in case an
instruction is related to multiple accesses. However, in the vector code
generation we want to know the stride of the array access of a store
instruction. By using getArrayAccessFor we ensure we always get the correct
memory access.

This patch fixes a potential bug, but I was unable to produce a failing test
case. Several existing test cases cover this code, but all of them already
passed out of luck (or the specific but not-guaranteed order in which we build
memory accesses).

llvm-svn: 255715
2015-12-15 23:50:01 +00:00
Tobias Grosser a69d4f0d83 VectorBlockGenerator: Generate scalar loads for vector statements
When generating scalar loads/stores separately the vector code has not been
updated. This commit adds code to generate scalar loads for vector code as well
as code to assert in case scalar stores are encountered within a vector loop.

llvm-svn: 255714
2015-12-15 23:49:58 +00:00
Tobias Grosser 0921477248 ScopInfo: Look up first (and only) array access
When rewriting the access functions of load/store statements, we are only
interested in the actual array memory location. The current code just took
the very first memory access, which could be a scalar or an array access. As
a result, we failed to update access functions even though this was requested
via .jscop.

llvm-svn: 255713
2015-12-15 23:49:53 +00:00
Michael Kruse 5bbc0e1888 Fix typos; NFC
llvm-svn: 255580
2015-12-14 23:41:32 +00:00
Tobias Grosser 9bd0dad926 BlockGenerator: Do not use fast-path for external constants
This change should not change the behavior of Polly today, but it allows
external constants to be remapped e.g. when targetting multiple LLVM modules.

llvm-svn: 255506
2015-12-14 16:19:59 +00:00
Tobias Grosser 6f764bbd9c BlockGenerator: Drop unneeded const_casts
llvm-svn: 255505
2015-12-14 16:19:54 +00:00
Tobias Grosser f4f6870ff2 Revert "Always treat scalar writes as MUST_WRITEs"
This reverts commit r255471.

Johannes raised in the post-commit review of r255471 the concern that PHI
writes in non-affine regions with two exiting blocks are not really MUST_WRITE,
but we just know that at least one out of the set of all possible PHI writes
will be executed. Modeling all PHI nodes as MUST_WRITEs is probably save, but
adding the needed documentation for such a special case is probably not worth
the effort. Michael will be proposing a new patch that ensures only a single
PHI_WRITE is created for non-affine regions, which - besides other benefits -
should also allow us to use a single well-defined MUST_WRITE for such PHI
writes.

(This is not a full revert, but the condition and documentation have been
slightly extended)

llvm-svn: 255503
2015-12-14 15:05:37 +00:00
Michael Kruse e0d135c536 Add unit test for r255473
Check that memory accesses in non-affine regions that are always executed are
MUST_WRITE.

llvm-svn: 255500
2015-12-14 14:53:30 +00:00
Michael Kruse 34e1122a0d Rename addScalar(Read|Write)Access to addValue(Read|Write)Access
Adapt the method names to the new scheme introduced in r255467.

llvm-svn: 255474
2015-12-13 22:47:43 +00:00
Michael Kruse e934725f1d Check guaranteed execution by using DominatorTree
Before this commit, only the region's entry block was assumed to always
execute in a non-affine subregion. We replace this by a test whether it
dominates the exit block (this necessarily includes the entry block)
which should be more accurate.

llvm-svn: 255473
2015-12-13 22:10:40 +00:00