llvm-project/polly/test/Isl/CodeGen/MemAccess
Michael Kruse b738ffa845 Heap allocation for new arrays.
This patch aims to implement the option of allocating new arrays created
by polly on heap instead of stack. To enable this option, a key named
'allocation' must be written in the imported json file with the value
'heap'.

We need such a feature because in a next iteration, we will implement a
mechanism of maximal static expansion which will need a way to allocate
arrays on heap. Indeed, the expansion is very costly in terms of memory
and doing the allocation on stack is not worth considering.

The malloc and the free are added respectively at polly.start and
polly.exiting such that there is no use-after-free (for instance in case
of Scop in a loop) and such that all memory cells allocated with a
malloc are free'd when we don't need them anymore.

We also add :

- In the class ScopArrayInfo, we add a boolean as member called IsOnHeap
  which represents the fact that the array in allocated on heap or not.
- A new branch in the method allocateNewArrays in the ISLNodeBuilder for
  the case of heap allocation. allocateNewArrays now takes a BBPair
  containing polly.start and polly.exiting. allocateNewArrays takes this
  two blocks and add the malloc and free calls respectively to
  polly.start and polly.exiting.
- As IntPtrTy for the malloc call, we use the DataLayout one.

To do that, we have modified :

- createScopArrayInfo and getOrCreateScopArrayInfo such that it returns
  a non-const SAI, in order to be able to call setIsOnHeap in the
  JSONImporter.
- executeScopConditionnaly such that it return both start block and end
  block of the scop, because we need this two blocs to be able to add
  the malloc and the free calls at the right position.

Differential Revision: https://reviews.llvm.org/D33688

llvm-svn: 306540
2017-06-28 13:02:43 +00:00
..
bad_alignment.ll tests: Drop -polly-detect-unprofitable and -polly-no-early-exit 2015-10-06 15:36:44 +00:00
bad_alignment___%for.cond---%for.end.jscop [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
codegen_address_space.ll This reverts recent expression type changes 2016-06-11 19:17:15 +00:00
codegen_constant_offset.ll tests: Drop -polly-detect-unprofitable and -polly-no-early-exit 2015-10-06 15:36:44 +00:00
codegen_constant_offset___%for.cond---%for.end.jscop [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
codegen_constant_offset___%for.cond---%for.end.jscop.transformed [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
codegen_simple.ll tests: Drop -polly-detect-unprofitable and -polly-no-early-exit 2015-10-06 15:36:44 +00:00
codegen_simple___%for.cond---%for.end.jscop [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
codegen_simple___%for.cond---%for.end.jscop.transformed [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
codegen_simple_float.ll tests: Drop -polly-detect-unprofitable and -polly-no-early-exit 2015-10-06 15:36:44 +00:00
codegen_simple_md.ll This reverts recent expression type changes 2016-06-11 19:17:15 +00:00
codegen_simple_md___%for.cond---%for.end6.jscop [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
codegen_simple_md___%for.cond---%for.end6.jscop.transformed+withconst [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
codegen_simple_md___%for.cond---%for.end6.jscop.transformed+withoutconst [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
codegen_simple_md_float.ll This reverts recent expression type changes 2016-06-11 19:17:15 +00:00
create_arrays.ll [CodeGen] Emit aliasing metadata for new arrays. 2017-06-19 10:19:29 +00:00
create_arrays___%bb9---%bb26.jscop Store the size of the outermost dimension in case of newly created arrays that require memory allocation. 2016-09-12 17:08:31 +00:00
create_arrays___%bb9---%bb26.jscop.transformed Store the size of the outermost dimension in case of newly created arrays that require memory allocation. 2016-09-12 17:08:31 +00:00
create_arrays_heap.ll Heap allocation for new arrays. 2017-06-28 13:02:43 +00:00
create_arrays_heap___%for.cond1.preheader---%for.end18.jscop Heap allocation for new arrays. 2017-06-28 13:02:43 +00:00
create_arrays_heap___%for.cond1.preheader---%for.end18.jscop.transformed Heap allocation for new arrays. 2017-06-28 13:02:43 +00:00
default_aligned_new_access_function.ll Add space between access string and follow-up. 2016-08-26 15:43:52 +00:00
different_types.ll This reverts recent expression type changes 2016-06-11 19:17:15 +00:00
different_types___%bb2---%bb18.jscop Codegen: Support memory accesses with different types 2015-09-29 06:44:38 +00:00
generate-all.ll [Polly] Generate more 'canonical' induction variable 2017-05-12 02:17:15 +00:00
invariant_base_ptr.ll Relax assert when setting access functions with invariant base pointers 2017-01-17 12:00:42 +00:00
invariant_base_ptr___%loop---%exit.jscop Add test showing the update of access functions with in-scop defined base ptrs 2017-01-16 17:51:28 +00:00
map_scalar_access.ll Allow mapping scalar MemoryAccesses to array elements. 2016-09-01 19:53:31 +00:00
map_scalar_access___%outer.for---%return.jscop Store the size of the outermost dimension in case of newly created arrays that require memory allocation. 2016-09-12 17:08:31 +00:00
map_scalar_access___%outer.for---%return.jscop.transformed Store the size of the outermost dimension in case of newly created arrays that require memory allocation. 2016-09-12 17:08:31 +00:00
multiple_types.ll This reverts recent expression type changes 2016-06-11 19:17:15 +00:00
multiple_types___%bb1---%bb22.jscop Support accesses with differently sized types to the same array 2016-02-04 13:18:42 +00:00
simple.ll tests: Drop -polly-detect-unprofitable and -polly-no-early-exit 2015-10-06 15:36:44 +00:00
simple___%for.cond---%for.end.jscop [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
simple___%for.cond---%for.end.jscop.transformed [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
simple___%for.cond---%for.end14.jscop [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
simple___%for.cond---%for.end14.jscop.transformed [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
simple___%for.cond4---%for.end14.jscop [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
simple___%for.cond4---%for.end14.jscop.transformed [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
simple_analyze.ll Add space between access string and follow-up. 2016-08-26 15:43:52 +00:00
simple_stride___%for.cond---%for.end.jscop [NFC] Drop the "scattering" tuple name 2015-02-02 13:45:54 +00:00
simple_stride_test.ll This reverts recent expression type changes 2016-06-11 19:17:15 +00:00
update_access_functions.ll [Polly] Generate more 'canonical' induction variable 2017-05-12 02:17:15 +00:00
update_access_functions___%loop1---%exit.jscop tests: fix order of memory accesses to ensure import succeeds 2016-07-21 07:12:17 +00:00
update_access_functions___%loop1---%exit.jscop.transformed tests: fix order of memory accesses to ensure import succeeds 2016-07-21 07:12:17 +00:00