Commit Graph

2229 Commits

Author SHA1 Message Date
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