platform/upstream/isl.git
11 years agodeclare isl_*_list together with isl_*
Sven Verdoolaege [Wed, 27 Mar 2013 11:09:23 +0000 (12:09 +0100)]
declare isl_*_list together with isl_*

Some of the isl_*_list types were declared together in isl/list.h.
It seems cleaner to declare them together with the corresponding isl_* instead.
Similarly, these types were defined together in isl_list_private.h and
are now defined together with the corresponding isl_*.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_graft.c: remove spurious include
Sven Verdoolaege [Sun, 21 Apr 2013 15:56:13 +0000 (17:56 +0200)]
isl_ast_graft.c: remove spurious include

The include has been redundant ever since it was introduced in
5888ac1 (add support for generating ASTs from schedule relations,
Mon Sep 17 22:11:06 2012 +0200).

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_codegen.c: remove dependence on internals of isl_constraint_list
Sven Verdoolaege [Tue, 2 Apr 2013 09:00:25 +0000 (11:00 +0200)]
isl_ast_codegen.c: remove dependence on internals of isl_constraint_list

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoextract generic isl_*_list_foreach_scc from isl_ast_codegen.c
Sven Verdoolaege [Mon, 1 Apr 2013 09:47:03 +0000 (11:47 +0200)]
extract generic isl_*_list_foreach_scc from isl_ast_codegen.c

isl_ast_codegen.c contained two implementations of this function
that have now been replaced by two calls to the extracted functions.
This makes isl_ast_codegen.c less dependent on the internals of
isl_basic_set_list.  We should also be able to later reuse the
extracted function in other contexts.  Once all users of isl_tarjan
have been converted to this interface, we probably want to remove
the old interface and perform the calls to callback as soon as
each SCC is found rather than waiting until all of them have been found.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_affine_hull: make stride information explicit before dropping divs
Sven Verdoolaege [Fri, 19 Apr 2013 14:57:00 +0000 (16:57 +0200)]
isl_map_affine_hull: make stride information explicit before dropping divs

In a2cbe44 (isl_map_affine_hull: avoid computing explicit representations
for divs, Sun Jan 15 16:12:59 2012 +0100), isl_map_affine_hull was changed
to drop unknown divs rather than computing an explicit representation
for them.  This caused some stride information that involves multiple
unknown divs to get dropped.
Try and recover this lost information by making stride information
explicitly available before dropping the unknown divs.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_morph.c: extract out isl_mat_parameter_compression_ext
Sven Verdoolaege [Fri, 19 Apr 2013 14:54:18 +0000 (16:54 +0200)]
isl_morph.c: extract out isl_mat_parameter_compression_ext

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_get_stride_constraint: combine multiple strides
Sven Verdoolaege [Fri, 19 Apr 2013 09:42:09 +0000 (11:42 +0200)]
isl_ast_build_get_stride_constraint: combine multiple strides

If we find multiple constraints from which can derive a stride,
then we would only keep the stride information from the last
of these constraints.  We now combine multiple strides into
a single stride.  Note that this may not have any effect in practice
because multiple strides are usually already combined into one
at the level of the constraints of a basic set.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build.c: use isl_int_gcdext instead of open-coded version
Sven Verdoolaege [Wed, 17 Apr 2013 15:51:55 +0000 (17:51 +0200)]
isl_ast_build.c: use isl_int_gcdext instead of open-coded version

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_int_gcdext
Sven Verdoolaege [Wed, 17 Apr 2013 15:51:28 +0000 (17:51 +0200)]
add isl_int_gcdext

We will use it in the next commit.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_ast_from_schedule: also add stride guard in generic case
Sven Verdoolaege [Fri, 19 Apr 2013 08:08:11 +0000 (10:08 +0200)]
isl_ast_build_ast_from_schedule: also add stride guard in generic case

Any guard implied by the stride constraint in the AST build domain
needs to be enforced by the generated AST and may not necessarily
be implied by the strided loop itself.
We were already adding this guard to the graft in the degenerate case,
but not in the generic case.

The implied guard is usually already available in loop bounds constraints,
so it is not clear if this fixes any bug that can appear in practice,
However, this may just be a consequence of the internal representation of sets
and we should not depend too much on this internal representation.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_set_loop_bounds: compute divs after eliminating strided dimension
Sven Verdoolaege [Thu, 18 Apr 2013 14:12:00 +0000 (16:12 +0200)]
isl_ast_build_set_loop_bounds: compute divs after eliminating strided dimension

Although it is unlikely that the elimination would result in any unknown divs,
we had better make sure to preserve the invariant that build->domain does not
have any unknown divs.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_simplify.c: normalize_divs_in_context: improve error handling
Sven Verdoolaege [Thu, 18 Apr 2013 13:02:47 +0000 (15:02 +0200)]
isl_map_simplify.c: normalize_divs_in_context: improve error handling

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_expr.c: remove left-over from refactoring
Sven Verdoolaege [Wed, 17 Apr 2013 14:20:14 +0000 (16:20 +0200)]
isl_ast_build_expr.c: remove left-over from refactoring

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_codegen.c: create_node_scaled: reflect current domain slice in schedule
Sven Verdoolaege [Thu, 11 Apr 2013 15:36:38 +0000 (17:36 +0200)]
isl_ast_codegen.c: create_node_scaled: reflect current domain slice in schedule

If we detect that a given schedule dimension has a fixed (possibly
parametric) value, then this value is recorded in the build and
the schedule dimension is eliminated.  This elimination process may
drop constraints on the part of the domain that we are currently considering,
which may cause all sorts of problems.  In particular, we may fail
to discover at the end of the AST generation that the original schedule
was single valued and insert spurious loops.

Plug in the value we found instead of simply eliminating the schedule
dimension.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_union_map_preimage_domain_multi_aff
Sven Verdoolaege [Fri, 12 Apr 2013 16:18:31 +0000 (18:18 +0200)]
add isl_union_map_preimage_domain_multi_aff

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_map_preimage_domain_multi_aff
Sven Verdoolaege [Tue, 16 Apr 2013 13:01:00 +0000 (15:01 +0200)]
add isl_map_preimage_domain_multi_aff

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_preimage_multi_aff: micro-refactoring
Sven Verdoolaege [Tue, 16 Apr 2013 12:15:41 +0000 (14:15 +0200)]
isl_basic_map_preimage_multi_aff: micro-refactoring

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_simplify.c: div_is_redundant: ignore coefficients of unknown divs
Sven Verdoolaege [Tue, 16 Apr 2013 09:49:05 +0000 (11:49 +0200)]
isl_map_simplify.c: div_is_redundant: ignore coefficients of unknown divs

If a div is unknown, then its coefficients are undefined so we should
not take them into account while checking if some other div is redundant.
In rare cases, looking at those undefined coefficients could result
in system dependent behavior.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agogeneralize isl_basic_set_preimage_multi_aff to isl_basic_map_preimage_multi_aff
Sven Verdoolaege [Fri, 12 Apr 2013 15:26:10 +0000 (17:26 +0200)]
generalize isl_basic_set_preimage_multi_aff to isl_basic_map_preimage_multi_aff

This will allow us to implement isl_map_preimage_domain_multi_aff.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_ast_from_schedule: also add stride guard in generic case
Sven Verdoolaege [Fri, 19 Apr 2013 08:08:11 +0000 (10:08 +0200)]
isl_ast_build_ast_from_schedule: also add stride guard in generic case

Any guard implied by the stride constraint in the AST build domain
needs to be enforced by the generated AST and may not necessarily
be implied by the strided loop itself.
We were already adding this guard to the graft in the degenerate case,
but not in the generic case.

The implied guard is usually already available in loop bounds constraints,
so it is not clear if this fixes any bug that can appear in practice,
However, this may just be a consequence of the internal representation of sets
and we should not depend too much on this internal representation.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_set_loop_bounds: compute divs after eliminating strided dimension
Sven Verdoolaege [Thu, 18 Apr 2013 14:12:00 +0000 (16:12 +0200)]
isl_ast_build_set_loop_bounds: compute divs after eliminating strided dimension

Although it is unlikely that the elimination would result in any unknown divs,
we had better make sure to preserve the invariant that build->domain does not
have any unknown divs.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_simplify.c: normalize_divs_in_context: improve error handling
Sven Verdoolaege [Thu, 18 Apr 2013 13:02:47 +0000 (15:02 +0200)]
isl_map_simplify.c: normalize_divs_in_context: improve error handling

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map.c: fix typo in comment
Sven Verdoolaege [Tue, 16 Apr 2013 11:42:09 +0000 (13:42 +0200)]
isl_map.c: fix typo in comment

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoextend isl_seq_preimage to allow taking preimage of a subset of dimensions
Sven Verdoolaege [Fri, 12 Apr 2013 14:57:31 +0000 (16:57 +0200)]
extend isl_seq_preimage to allow taking preimage of a subset of dimensions

This will allow us to reuse isl_seq_preimage for computing the preimage
of the domain or range of a basic map.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_simplify.c: div_is_redundant: ignore coefficients of unknown divs
Sven Verdoolaege [Tue, 16 Apr 2013 09:49:05 +0000 (11:49 +0200)]
isl_map_simplify.c: div_is_redundant: ignore coefficients of unknown divs

If a div is unknown, then its coefficients are undefined so we should
not take them into account while checking if some other div is redundant.
In rare cases, looking at those undefined coefficients could result
in system dependent behavior.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoMerge branch 'maint'
Sven Verdoolaege [Mon, 15 Apr 2013 20:36:51 +0000 (22:36 +0200)]
Merge branch 'maint'

11 years agoisl_ast_codegen.c: fix typo in comment
Sven Verdoolaege [Mon, 15 Apr 2013 20:08:53 +0000 (22:08 +0200)]
isl_ast_codegen.c: fix typo in comment

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_ast_from_schedule: properly handle union atomic options
Sven Verdoolaege [Mon, 15 Apr 2013 12:02:05 +0000 (14:02 +0200)]
isl_ast_build_ast_from_schedule: properly handle union atomic options

In particular, if the domain for which a given dimension should
be atomic is a union of basic sets, then the actual atomic domain
may be larger than this union and we need to make sure that this
larger set is removed from the remainder domain to preserve
the invariant that the elements of the list computed by compute_domains
are disjoint.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_codegen.c: update_unrolling_lower_bound: check for overflow
Sven Verdoolaege [Mon, 15 Apr 2013 10:55:59 +0000 (12:55 +0200)]
isl_ast_codegen.c: update_unrolling_lower_bound: check for overflow

If the number of slices along a given lower bound exceeds the maximal
value of an integer, then it would mistakenly be replaced by its
least signficant bits, resulting in slices being dropped if the lower
bound ends up being selected as the best (based on the wrong number).
If the number of slices really exceeds the maximal value of an integer,
then we do not want to honor the request of the user anyway.
We should probably set an even smaller limit.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_mat_free: return NULL
Sven Verdoolaege [Tue, 9 Apr 2013 14:22:53 +0000 (16:22 +0200)]
isl_mat_free: return NULL

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_insert_dims: plug memory leak when called on empty input
Sven Verdoolaege [Thu, 11 Apr 2013 15:47:21 +0000 (17:47 +0200)]
isl_basic_map_insert_dims: plug memory leak when called on empty input

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoChangeLog: drop some text that appears to have been copied by mistake
Sven Verdoolaege [Thu, 11 Apr 2013 10:32:23 +0000 (12:32 +0200)]
ChangeLog: drop some text that appears to have been copied by mistake

In particular, the text was copied by 9fe3e28 (isl 0.10,
Sun Jun 3 15:47:09 2012 +0200).

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl 0.11.2 isl-0.11.2
Sven Verdoolaege [Tue, 9 Apr 2013 09:51:29 +0000 (11:51 +0200)]
isl 0.11.2

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd missing interface/all.h and interface/isl.py.top to distribution
Sven Verdoolaege [Tue, 9 Apr 2013 16:36:35 +0000 (18:36 +0200)]
add missing interface/all.h and interface/isl.py.top to distribution

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_schedule.c: sort_band_list: take into account that parent may be NULL
Sven Verdoolaege [Tue, 9 Apr 2013 15:37:46 +0000 (17:37 +0200)]
isl_schedule.c: sort_band_list: take into account that parent may be NULL

We missed this in 81bf4c2 (isl_schedule_get_band_forest: sort bands
in band list, Tue Feb 26 12:35:16 2013 +0100).

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_schedule_get_map: pad schedule map with zeros if reconstructed from bands
Sven Verdoolaege [Tue, 9 Apr 2013 15:37:35 +0000 (17:37 +0200)]
isl_schedule_get_map: pad schedule map with zeros if reconstructed from bands

The schedule map extracted from the isl_schedule_nodes is padded with zeros
by construction.  However, if the schedule map is reconstructed from the
band forest, then the schedule map was not be padded with zeros.
Pad this schedule as well.

We may want to change isl_band_list_get_suffix_schedule to perform this
padded instead.

Reported-by: Ali El Moussawi <elmoussawi.ali@gmail.com>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_graft.c: store_guard: coalesce guard after taking gist
Sven Verdoolaege [Thu, 4 Apr 2013 13:22:10 +0000 (15:22 +0200)]
isl_ast_graft.c: store_guard: coalesce guard after taking gist

On rare occasions, coalescing may simplify the gisted guard.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoMerge branch 'maint'
Sven Verdoolaege [Sun, 7 Apr 2013 15:38:40 +0000 (17:38 +0200)]
Merge branch 'maint'

11 years agoisl_ast_node_print: avoid duplicate declarations in printed code
Sven Verdoolaege [Fri, 29 Mar 2013 13:53:13 +0000 (14:53 +0100)]
isl_ast_node_print: avoid duplicate declarations in printed code

If a loop has only one iteration but if the expression
for this single iteration is too complicated to be substituted into the AST,
then the expression is assigned to a variable corresponding to the loop
iterator.
If two such loops occur in the same block, then we would end up with
two declarations of the same variable.  Avoid this problem by introducing
a block around the declaration if it appears in a sequence of statements.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast.c: extract out start_block and end_block from print_ast_node_c
Sven Verdoolaege [Sun, 7 Apr 2013 15:13:12 +0000 (17:13 +0200)]
isl_ast.c: extract out start_block and end_block from print_ast_node_c

We will be able to reuse them in the next commit.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoconfigure.ac: explicitly link in llvm bitreader component in extract_interface
Sven Verdoolaege [Sun, 7 Apr 2013 12:07:27 +0000 (14:07 +0200)]
configure.ac: explicitly link in llvm bitreader component in extract_interface

Apparently, the bitreader component is required for ASTReader and
is no longer included implicitly.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoupdate for change in arguments of clang's HeaderSearchOptions::AddPath
Sven Verdoolaege [Sun, 7 Apr 2013 11:20:41 +0000 (13:20 +0200)]
update for change in arguments of clang's HeaderSearchOptions::AddPath

In particular, the IsUserSpecified argument has been removed.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoupdate for change in arguments of clang's CompilerInstance::createDiagnostics
Sven Verdoolaege [Sun, 7 Apr 2013 11:13:14 +0000 (13:13 +0200)]
update for change in arguments of clang's CompilerInstance::createDiagnostics

In particular, CompilerInstance::createDiagnostics no longer takes
argc and argv as arugments.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_codegen.c: fix typo in comment
Sven Verdoolaege [Mon, 1 Apr 2013 10:13:31 +0000 (12:13 +0200)]
isl_ast_codegen.c: fix typo in comment

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_graft_list_sort_guard: use isl_ast_graft_list_sort
Sven Verdoolaege [Wed, 27 Mar 2013 11:31:32 +0000 (12:31 +0100)]
isl_ast_graft_list_sort_guard: use isl_ast_graft_list_sort

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_*_list_sort
Sven Verdoolaege [Wed, 27 Mar 2013 11:27:40 +0000 (12:27 +0100)]
add isl_*_list_sort

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agorename isl_ast_graft_list_sort to isl_ast_graft_list_sort_guard
Sven Verdoolaege [Wed, 27 Mar 2013 11:27:23 +0000 (12:27 +0100)]
rename isl_ast_graft_list_sort to isl_ast_graft_list_sort_guard

We will introduce a generic isl_*_list_sort in the next commit.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_affine_hull: avoid computing explicit representations for divs
Sven Verdoolaege [Sun, 15 Jan 2012 15:12:59 +0000 (16:12 +0100)]
isl_map_affine_hull: avoid computing explicit representations for divs

If an existentially quantified variable is not determined by an equality
then it should have little effect on the overall affine hull.
There should therefor be no need to compute explicit representations
for these existentially quantified variables, which is a possibly costly
operation and which can result in large number of basic maps.

Instead, we first compute the affine hull of each basic map separately,
extract an explicit representation for existentially quantified variables
determined by an equality and then remove all unknown divs before aligning
the divs over the basic maps.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_coalesce: extend the handling of a pair adjacent inequalities
Sven Verdoolaege [Sat, 23 Mar 2013 14:55:02 +0000 (15:55 +0100)]
isl_map_coalesce: extend the handling of a pair adjacent inequalities

In particular, one of the adjacent inequalities may imply an equality
on the integer points in the corresponding set and this equality will
not be valid for the other set.
For example, the set

{ [x,y] : 0 <= x <= 2 and y >= 0 and x + 2y <= 4;
  [x,y] : 3 <= x <= 4 and y >= 0 and x + 2y <= 4 }

may be simplified to

{ [x,y] : 0 <= x <= 2 and y >= 0 and x + 2y <= 4;
  [x,0] : 3 <= x <= 4 }

and the equality y = 0 is not valid for the other component.
However, we may still be able to fuse in such cases if all the constraints
of the other component are valid for the component with the equality and if
we can show that replacing the adjacent inequality x <= 2 by its opposite
(x >= 3) and adding the valid constraints (x <= 4) of the component with
the equality results in a subset of this component.  Since it is also
a superset of this component (all its constraints are valid for the component),
we can fuse the two components by combining their valid constraints.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_tab_unrestrict
Sven Verdoolaege [Sat, 23 Mar 2013 14:53:50 +0000 (15:53 +0100)]
add isl_tab_unrestrict

This will be useful for another special case of coalescing.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_coalesce.c: fix typo in comment
Sven Verdoolaege [Wed, 27 Mar 2013 08:03:24 +0000 (09:03 +0100)]
isl_coalesce.c: fix typo in comment

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_test: generalize coalesce tests
Sven Verdoolaege [Sat, 23 Mar 2013 11:20:52 +0000 (12:20 +0100)]
isl_test: generalize coalesce tests

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_set_{lexmin,lexmax}_pw_multi_aff
Sven Verdoolaege [Thu, 28 Mar 2013 13:06:25 +0000 (14:06 +0100)]
add isl_set_{lexmin,lexmax}_pw_multi_aff

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_tab_get_ctx
Sven Verdoolaege [Fri, 22 Mar 2013 12:00:34 +0000 (13:00 +0100)]
add isl_tab_get_ctx

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_mat_variable_compression: add memory management annotations
Sven Verdoolaege [Fri, 22 Mar 2013 11:58:46 +0000 (12:58 +0100)]
isl_mat_variable_compression: add memory management annotations

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_mat_product: add memory management annotations
Sven Verdoolaege [Fri, 22 Mar 2013 11:58:05 +0000 (12:58 +0100)]
isl_mat_product: add memory management annotations

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoMerge branch 'maint'
Sven Verdoolaege [Sun, 24 Mar 2013 13:00:21 +0000 (14:00 +0100)]
Merge branch 'maint'

11 years agoisl_tab_basic_map_partial_lexopt: disable use of shifted tableau on equalities
Sven Verdoolaege [Sun, 24 Mar 2013 12:46:44 +0000 (13:46 +0100)]
isl_tab_basic_map_partial_lexopt: disable use of shifted tableau on equalities

If the input context already involves equalities then the shfited tableau
is not used as it would be empty.  However, if equalities are added at
a later stage (e.g., transferred for the input map), then we would fail
to disable the use of the shifted tableau, possibly resulting in invalid
sample values being computing from this shifted tableau.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_tab_pip.c: context_gbr_detect_equalities: improve error handling
Sven Verdoolaege [Sun, 24 Mar 2013 09:20:24 +0000 (10:20 +0100)]
isl_tab_pip.c: context_gbr_detect_equalities: improve error handling

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoupdate ax_create_pkgconfig_info.m4 to latest upstream version
Sven Verdoolaege [Wed, 20 Mar 2013 09:27:28 +0000 (10:27 +0100)]
update ax_create_pkgconfig_info.m4 to latest upstream version

The main change is that user CPPFLAGS and LDFLAGS are no longer added
to the generated .pc file.  These flags are specified by the user for
compiling isl and may not make sense for compiling libraries or applications
that depend on isl.

Reported-by: Samuli Suominen <ssuominen.private@gmail.com>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_mat_drop_cols: special case dropping of zero columns
Sven Verdoolaege [Wed, 20 Mar 2013 09:17:34 +0000 (10:17 +0100)]
isl_mat_drop_cols: special case dropping of zero columns

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_foreach_lexopt: properly merge partial solutions
Sven Verdoolaege [Wed, 20 Mar 2013 08:55:50 +0000 (09:55 +0100)]
isl_basic_map_foreach_lexopt: properly merge partial solutions

If we detect two identical solutions in adjacent parts of the search space,
then we merge them into a single solution.  The combined domain may however
have fewer existentially quantified variables and so we also need to adjust
the matrix representing the solution on that domain to no longer refer
to the extra existentially quantified variables.  Otherwise, the code
in sol_for_add could end up accessing elements of aff->v outside its bounds.
Note that it is safe to remove the columns that refer to the extra
existentially quantified variables since their coefficients need to be zero
for the two partial solutions to be considered identical.

Reported-by: Andreas Kloeckner <lists@informa.tiker.net>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_tab_basic_map_partial_lexopt: better exploit partial solution cache
Sven Verdoolaege [Tue, 12 Mar 2013 16:25:04 +0000 (17:25 +0100)]
isl_tab_basic_map_partial_lexopt: better exploit partial solution cache

In 4fff507 (isl_tab_pip: keep cache of partial solutions,
Fri Oct 16 14:46:28 2009 +0200) we introduced a cache of partial solutions
so that we could attempt to merge them before adding them to the result.
The merging happens during backtracking, however, and once we reached
the end of the search tree, we would not backtrack back to the root anymore.

We now do track back to the root of the search tree such that partial
solution in the final part of the search tree could also potentially
be merged.  We only do this if there is some chance that we may find
identical partial solutions since the rollback of the context tableau
does not come for free.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_lexopt: preinitialize domain
Sven Verdoolaege [Tue, 12 Mar 2013 16:23:49 +0000 (17:23 +0100)]
isl_basic_map_lexopt: preinitialize domain

The original code would pass a universe domain to isl_basic_map_partial_lexopt,
but this means that the parametric integer programming engine will consider
all inequalities as splitting (with respect to the universe context),
resulting in a fair amount of wasted effort.
More importantly, the border constraints may be transferred to the
context in the middle of constraints that actually split the context
into parts with possibly different solutions.  The current heuristic
for merging solutions that turn out to be identical will not be able
to transfer solution across the border constraints since they only
allow for a solution on one side of the constraint.

By prepopulating the domain with some of the constraints from the input map,
we can avoid some redundant computations and we improve the opportunities
for merging identical partial solutions.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoexport isl_basic_map_drop_constraints_involving_dims
Sven Verdoolaege [Tue, 12 Mar 2013 16:27:44 +0000 (17:27 +0100)]
export isl_basic_map_drop_constraints_involving_dims

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_compute_divs: compress existentially quantified variables
Sven Verdoolaege [Tue, 12 Mar 2013 13:56:36 +0000 (14:56 +0100)]
isl_basic_map_compute_divs: compress existentially quantified variables

This compression should simplify the computations during parametric
integer programming.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_compute_divs: recursively remove parameter equalities
Sven Verdoolaege [Tue, 19 Mar 2013 10:23:20 +0000 (11:23 +0100)]
isl_basic_map_compute_divs: recursively remove parameter equalities

The removal of explicit equalities among the parameters may uncover
additional equalities.  If so, we now recurse in parameter_compute_divs
so that also these extra equalities are removed.
This will be important for the next commit where we will try to compress
the existentially quantified variables and this requires the absence
of equalities among the parameters.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map.c: parameter_compute_divs: extract out first_parameter_equality
Sven Verdoolaege [Wed, 13 Mar 2013 07:21:36 +0000 (08:21 +0100)]
isl_map.c: parameter_compute_divs: extract out first_parameter_equality

We will be able to reuse this function in the next commit.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_set_parameter_compression: allow divs in input
Sven Verdoolaege [Tue, 12 Mar 2013 13:55:51 +0000 (14:55 +0100)]
isl_basic_set_parameter_compression: allow divs in input

For the purpose of compressing parameters, there should be no need
to make a distinction between set variables and existentially quantified
variables.
There does not appear to be any reason for not allowing existentially
quantified variables before other than the fact that we didn't need
to apply this function of basic sets with existentially quantified
variables before.  However, this will turn out to be useful when
we want to compress the unknown divs within isl_basic_map_compute_divs.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_compute_divs: preserve already known divs
Sven Verdoolaege [Tue, 12 Mar 2013 10:09:21 +0000 (11:09 +0100)]
isl_basic_map_compute_divs: preserve already known divs

The purpose of isl_basic_map_compute_divs is to ensure that all divs
have an explicit representation.  If we already have an explicit
representation for some of the divs, then there is no need to
recompute an explicit representation for them.  Instead, we preserve
the explicit representations of the known divs and only compute
explicit representations for the currently unknown divs.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_project_out: extract out insert_div_rows
Sven Verdoolaege [Sun, 17 Mar 2013 19:47:42 +0000 (20:47 +0100)]
isl_basic_map_project_out: extract out insert_div_rows

The new insert_div_rows function will be reused in the next commit.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_swap_div: extract out swap_div
Sven Verdoolaege [Sun, 17 Mar 2013 19:49:31 +0000 (20:49 +0100)]
isl_basic_map_swap_div: extract out swap_div

The new swap_div will be reused in a subsequent commit.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoMerge branch 'maint'
Sven Verdoolaege [Sun, 17 Mar 2013 18:49:06 +0000 (19:49 +0100)]
Merge branch 'maint'

11 years agoisl_map_coalesce: avoid dropping constraints redundant wrt implicit equalities
Sven Verdoolaege [Sat, 16 Mar 2013 13:40:56 +0000 (14:40 +0100)]
isl_map_coalesce: avoid dropping constraints redundant wrt implicit equalities

isl_map_coalesce first detects implicit equalities in the basic maps.
If two basic maps can indeed be coalesced, then fuse() would
only add this constraint to the fused basic map as an inequality.
Other constraints that imply that this constraint is actually an equality
are redundant with respect to the equality and would not get copied
inside fuse() either.  The end result is that we would lose information.

In principle, we could just modify fuse() to add the implicit equalities
to the fused basic map as equalities, but it seems more prudent to
turn them into explicit equalities from the start.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_band_split
Sven Verdoolaege [Thu, 14 Feb 2013 20:25:58 +0000 (21:25 +0100)]
add isl_band_split

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_schedule_get_band_forest: sort bands in band list
Sven Verdoolaege [Tue, 26 Feb 2013 11:35:16 +0000 (12:35 +0100)]
isl_schedule_get_band_forest: sort bands in band list

In particular if the partial schedule of the parent of a band list
assigns different constant values to the domains of the bands in the list,
then sort the bands according to those constant values.

This should provide for a more "natural" order to the user.
The need for sorting could be avoided entirely if we were to
construct a forest of bands directly from isl_union_set_compute_schedule.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agodeclare isl_union_pw_multi_aff_intersect_domain
Sven Verdoolaege [Tue, 26 Feb 2013 11:04:18 +0000 (12:04 +0100)]
declare isl_union_pw_multi_aff_intersect_domain

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd tile_shift_point_loops option
Sven Verdoolaege [Mon, 25 Feb 2013 12:56:24 +0000 (13:56 +0100)]
add tile_shift_point_loops option

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_union_pw_multi_aff_scale_vec
Sven Verdoolaege [Thu, 14 Mar 2013 17:21:47 +0000 (18:21 +0100)]
add isl_union_pw_multi_aff_scale_vec

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_pw_multi_aff_scale_vec
Sven Verdoolaege [Thu, 14 Mar 2013 17:12:24 +0000 (18:12 +0100)]
add isl_pw_multi_aff_scale_vec

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_multi_aff_scale_vec
Sven Verdoolaege [Thu, 14 Mar 2013 16:07:52 +0000 (17:07 +0100)]
add isl_multi_aff_scale_vec

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_simplify: avoid infinite loop on empty input
Sven Verdoolaege [Thu, 14 Mar 2013 16:47:14 +0000 (17:47 +0100)]
isl_basic_map_simplify: avoid infinite loop on empty input

eliminate_divs_ineq skips the step of actually removing the div
if the basic map is marked empty.  This is needed because in the
process of marking the basic map empty, the constraints may have
been replaced by the canonical representation of an empty basic map
which does not have any divs.
However, the basic map may have already been marked empty before,
possibly without having the constraints replaced by the canonical
representation.  In such cases, we would also skip the step that
remove the div, but it would actually still be present and we would
keep making "progress" in every iteration of isl_basic_map_simplify,
resulting in an infinite loop.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agogeneralize isl_union_pw_qpolynomial_sub to include isl_union_pw_multi_aff_sub
Sven Verdoolaege [Thu, 14 Mar 2013 08:31:01 +0000 (09:31 +0100)]
generalize isl_union_pw_qpolynomial_sub to include isl_union_pw_multi_aff_sub

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_pw_multi_aff_sub
Sven Verdoolaege [Thu, 14 Mar 2013 08:20:01 +0000 (09:20 +0100)]
add isl_pw_multi_aff_sub

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_multi_aff_sub
Sven Verdoolaege [Thu, 14 Mar 2013 08:11:28 +0000 (09:11 +0100)]
add isl_multi_aff_sub

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agogeneralize isl_multi_aff_add
Sven Verdoolaege [Wed, 13 Mar 2013 12:08:20 +0000 (13:08 +0100)]
generalize isl_multi_aff_add

In the short term, this generalization will be useful to implement
an isl_multi_aff_sub.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_set_parameter_compression: extend assertion
Sven Verdoolaege [Wed, 13 Mar 2013 07:43:59 +0000 (08:43 +0100)]
isl_basic_set_parameter_compression: extend assertion

We were only checking if the number of equalities is less than
or equal to the number of variables, while the code also assumes
that all of the equalities involves at least one variable.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map.c: parameter_compute_divs: check result of isl_basic_set_gauss call
Sven Verdoolaege [Wed, 13 Mar 2013 07:13:00 +0000 (08:13 +0100)]
isl_map.c: parameter_compute_divs: check result of isl_basic_set_gauss call

The return value has been completely ignored ever since the call
was introduced in 2bc8301 (isl_pip_basic_map_compute_divs: remove some
equalities first, Mon May 25 12:59:23 2009 +0200).  This may be harmless
in practice at the moment, but it may lead to future bugs.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_arg.c: drop_argument: avoid out-of-bounds array accesses
Sven Verdoolaege [Sat, 9 Mar 2013 20:19:13 +0000 (21:19 +0100)]
isl_arg.c: drop_argument: avoid out-of-bounds array accesses

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_gist_basic_map: avoid invalid access on error
Sven Verdoolaege [Tue, 12 Mar 2013 13:56:12 +0000 (14:56 +0100)]
isl_map_gist_basic_map: avoid invalid access on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_ast_from_schedule: avoid introducing iterator in hoisted condition
Sven Verdoolaege [Sat, 9 Mar 2013 20:19:13 +0000 (21:19 +0100)]
isl_ast_build_ast_from_schedule: avoid introducing iterator in hoisted condition

ast_graft_list_fuse was being passed the build of the inner level from
create_node_scaled, which could result in the current loop iterator
getting introduced in the hoisted condition.
Since we need the inner build for simplifying the expressions generated
from the conditions that are not hoisted out, we now pass two builds
to ast_graft_list_fuse.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_ast_from_schedule: make construction of ors in ifs optional
Sven Verdoolaege [Thu, 28 Feb 2013 15:54:00 +0000 (16:54 +0100)]
isl_ast_build_ast_from_schedule: make construction of ors in ifs optional

If disjunctions in if conditions are not allowed by the user, then
the node is duplicated and each each disjunct is inserted separately.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoMerge branch 'maint'
Sven Verdoolaege [Fri, 8 Mar 2013 10:14:01 +0000 (11:14 +0100)]
Merge branch 'maint'

11 years agoisl_basic_set_sort_constraints: take into account all coefficients
Sven Verdoolaege [Thu, 7 Mar 2013 12:48:18 +0000 (13:48 +0100)]
isl_basic_set_sort_constraints: take into account all coefficients

The comparison function was mistakenly not taking into account
the coefficient of the last variable.  By ignoring this last
coefficient, the comparison could not guarantee the property required
by uset_gist.
Moreover, since constraints that only differ in this last coefficient
would compare equal to each other, the order of such constraints
could depend on the implementation of qsort, resulting in failing
test cases on Solaris 10.

We fix this problem by ignoring the constant term instead of
the last coefficient.  If two constraints only differ in the
constant term, then one of them should have been eliminated
already.

Reported-by: Amos <a.goo0h@gmail.com>
Tested-by: Marc Girod <marc.girod@gmail.com>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_ast_from_schedule: fix unrolling corner case
Sven Verdoolaege [Tue, 5 Mar 2013 20:35:22 +0000 (21:35 +0100)]
isl_ast_build_ast_from_schedule: fix unrolling corner case

In some rare cases, the constraint added to perform the unrolling
could get simplied away and then dropped after a simplification
of the domain.  We add the constraint back after the simplification
to ensure that it is present in the result.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_uncurry: add missing isl_basic_map_cow
Sven Verdoolaege [Wed, 27 Feb 2013 13:42:50 +0000 (14:42 +0100)]
isl_basic_map_uncurry: add missing isl_basic_map_cow

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_curry: add missing isl_basic_map_cow
Sven Verdoolaege [Wed, 27 Feb 2013 13:42:44 +0000 (14:42 +0100)]
isl_basic_map_curry: add missing isl_basic_map_cow

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agocodegen_test.sh: avoid use of constructs not supported by /bin/sh on Solaris
Sven Verdoolaege [Thu, 28 Feb 2013 15:59:03 +0000 (16:59 +0100)]
codegen_test.sh: avoid use of constructs not supported by /bin/sh on Solaris

Reported-by: Amos <a.goo0h@gmail.com>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_arg.c: extract out free_child
Sven Verdoolaege [Wed, 20 Feb 2013 11:53:23 +0000 (12:53 +0100)]
isl_arg.c: extract out free_child

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_arg.c: extract out free_user
Sven Verdoolaege [Wed, 20 Feb 2013 11:42:35 +0000 (12:42 +0100)]
isl_arg.c: extract out free_user

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>