platform/upstream/isl.git
11 years agoisl_basic_map_is_empty: avoid invalid access on error
Sven Verdoolaege [Sun, 2 Dec 2012 11:31:20 +0000 (12:31 +0100)]
isl_basic_map_is_empty: avoid invalid access on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_space_extend: avoid invalid access on error
Sven Verdoolaege [Sun, 2 Dec 2012 11:23:02 +0000 (12:23 +0100)]
isl_space_extend: avoid invalid access on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_subtract.c: basic_map_collect_diff: avoid invalid access on error
Sven Verdoolaege [Sun, 2 Dec 2012 11:22:48 +0000 (12:22 +0100)]
isl_map_subtract.c: basic_map_collect_diff: avoid invalid access on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_overlying_set: avoid invalid access on error
Sven Verdoolaege [Sun, 2 Dec 2012 11:21:46 +0000 (12:21 +0100)]
isl_basic_map_overlying_set: avoid invalid access on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map.c: basic_map_space_reset: handle NULL input
Sven Verdoolaege [Sun, 2 Dec 2012 11:20:44 +0000 (12:20 +0100)]
isl_map.c: basic_map_space_reset: handle NULL input

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_set_swap_vars: handle NULL input
Sven Verdoolaege [Sun, 2 Dec 2012 11:19:40 +0000 (12:19 +0100)]
isl_basic_set_swap_vars: handle NULL input

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_input.c: construct_constraints: respect memory management annotations
Sven Verdoolaege [Sun, 2 Dec 2012 11:18:26 +0000 (12:18 +0100)]
isl_input.c: construct_constraints: respect memory management annotations

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_codegen.c: create_node: avoid invalid access on error
Sven Verdoolaege [Sun, 2 Dec 2012 11:15:00 +0000 (12:15 +0100)]
isl_ast_codegen.c: create_node: avoid invalid access on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_codegen.c: for_inc: handle NULL input
Sven Verdoolaege [Sun, 2 Dec 2012 11:13:57 +0000 (12:13 +0100)]
isl_ast_codegen.c: for_inc: handle NULL input

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_pw_aff_set_rational: avoid invalid access on error
Sven Verdoolaege [Sun, 2 Dec 2012 11:12:14 +0000 (12:12 +0100)]
isl_pw_aff_set_rational: avoid invalid access on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_vec_dup: avoid invalid accesses on error
Sven Verdoolaege [Sun, 2 Dec 2012 10:00:22 +0000 (11:00 +0100)]
isl_vec_dup: avoid invalid accesses on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map.c: map_intersect_internal: properly plug memory leak on error path
Sven Verdoolaege [Sun, 2 Dec 2012 09:57:46 +0000 (10:57 +0100)]
isl_map.c: map_intersect_internal: properly plug memory leak on error path

The proposed fix in f85421c (isl_map.c: map_intersect_internal: plug memory
leak on error path, Fri Nov 30 18:10:08 2012 +0100) would only free "result",
but not "part".  Revert that commit and make sure both are freed.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoupdate for change in the constructor of the clang Driver
Sven Verdoolaege [Sat, 1 Dec 2012 14:17:15 +0000 (15:17 +0100)]
update for change in the constructor of the clang Driver

In particular, the Driver constructor no longer takes an IsProduction argument.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_vertices.c: vertices_from_list: plug memory leak on error path
Sven Verdoolaege [Sat, 1 Dec 2012 09:40:49 +0000 (10:40 +0100)]
isl_vertices.c: vertices_from_list: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_set_compute_vertices: plug memory leak on error path
Sven Verdoolaege [Sat, 1 Dec 2012 09:39:37 +0000 (10:39 +0100)]
isl_basic_set_compute_vertices: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_test.c: fix typo
Sven Verdoolaege [Sat, 1 Dec 2012 09:38:51 +0000 (10:38 +0100)]
isl_test.c: fix typo

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_test.c: test_output: avoid invalid access on error
Sven Verdoolaege [Thu, 29 Nov 2012 21:53:30 +0000 (22:53 +0100)]
isl_test.c: test_output: avoid invalid access on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_test.c: before_for: return early on error
Sven Verdoolaege [Sat, 1 Dec 2012 09:34:41 +0000 (10:34 +0100)]
isl_test.c: before_for: return early on error

In particular, don't print any spurious error messages.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_test.c: test_sample: return early on error
Sven Verdoolaege [Sat, 1 Dec 2012 09:34:41 +0000 (10:34 +0100)]
isl_test.c: test_sample: return early on error

In particular, don't print any spurious error messages.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_tab_pip.c: find_in_pos: plug memory leak on error path
Sven Verdoolaege [Fri, 30 Nov 2012 23:30:18 +0000 (00:30 +0100)]
isl_tab_pip.c: find_in_pos: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_tab_pip.c: add_parametric_cut: plug memory leak on error path
Sven Verdoolaege [Fri, 30 Nov 2012 23:29:56 +0000 (00:29 +0100)]
isl_tab_pip.c: add_parametric_cut: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_tab_pip.c: sol_push_sol: plug memory leak on error path
Sven Verdoolaege [Fri, 30 Nov 2012 23:28:49 +0000 (00:28 +0100)]
isl_tab_pip.c: sol_push_sol: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_space_dup: avoid invalid accesses on error
Sven Verdoolaege [Fri, 30 Nov 2012 23:25:49 +0000 (00:25 +0100)]
isl_space_dup: avoid invalid accesses on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_schedule.c: add_*_constraints: avoid invalid accesses on error
Sven Verdoolaege [Fri, 30 Nov 2012 23:24:02 +0000 (00:24 +0100)]
isl_schedule.c: add_*_constraints: avoid invalid accesses on error

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_reordering_extend_space: fix error handling
Sven Verdoolaege [Fri, 30 Nov 2012 23:22:27 +0000 (00:22 +0100)]
isl_reordering_extend_space: fix error handling

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_multi_*_realign_domain: plug memory leak on error path
Sven Verdoolaege [Fri, 30 Nov 2012 23:21:40 +0000 (00:21 +0100)]
isl_multi_*_realign_domain: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_subtract.c: map_is_subset: fix error handling
Sven Verdoolaege [Fri, 30 Nov 2012 23:19:27 +0000 (00:19 +0100)]
isl_map_subtract.c: map_is_subset: fix error handling

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map.c: update_dim_opt: return early on error
Sven Verdoolaege [Fri, 30 Nov 2012 22:23:29 +0000 (23:23 +0100)]
isl_map.c: update_dim_opt: return early on error

In particular, don't print any error messages based on the number
of elements in the list if the list doesn't exist.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_underlying_set: plug memory leak on error path
Sven Verdoolaege [Fri, 30 Nov 2012 17:27:22 +0000 (18:27 +0100)]
isl_basic_map_underlying_set: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map.c: map_intersect_internal: plug memory leak on error path
Sven Verdoolaege [Fri, 30 Nov 2012 17:10:08 +0000 (18:10 +0100)]
isl_map.c: map_intersect_internal: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_init_derived: check build->domain
Sven Verdoolaege [Fri, 30 Nov 2012 17:01:42 +0000 (18:01 +0100)]
isl_ast_build_init_derived: check build->domain

If something has gone wrong during the construction of the isl_ast_build,
its domain field may be NULL.  Since isl_ast_build_get_ctx obtains
the isl_ctx from this field, we should not continue if build->domain is NULL.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_input.c: read_aff_domain: remove spurious vars_free on error path
Sven Verdoolaege [Fri, 30 Nov 2012 16:59:58 +0000 (17:59 +0100)]
isl_input.c: read_aff_domain: remove spurious vars_free on error path

The vars structure passed to read_aff_domain is owned by the caller.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_input.c: read_map_tuple: return early on error
Sven Verdoolaege [Fri, 30 Nov 2012 16:57:23 +0000 (17:57 +0100)]
isl_input.c: read_map_tuple: return early on error

This avoids spurious error messages.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_input.c: accept_affine_list: plug memory leak on error path
Sven Verdoolaege [Fri, 30 Nov 2012 16:55:30 +0000 (17:55 +0100)]
isl_input.c: accept_affine_list: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_affine_hull.c: equalities_in_underlying_set: plug memory leak on error path
Sven Verdoolaege [Fri, 30 Nov 2012 16:50:37 +0000 (17:50 +0100)]
isl_affine_hull.c: equalities_in_underlying_set: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_tab_detect_equalities: plug memory leak on error path
Sven Verdoolaege [Fri, 30 Nov 2012 16:46:13 +0000 (17:46 +0100)]
isl_tab_detect_equalities: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_codegen.c: after_each_for: add missing return on error path
Sven Verdoolaege [Fri, 30 Nov 2012 16:52:50 +0000 (17:52 +0100)]
isl_ast_codegen.c: after_each_for: add missing return on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoreintroduce isl_basic_set_add symbol
Sven Verdoolaege [Thu, 29 Nov 2012 23:18:19 +0000 (00:18 +0100)]
reintroduce isl_basic_set_add symbol

This function was renamed in 461a2cd (rename isl_basic_set_add to
isl_basic_set_add_dims, Mon Oct 1 10:55:08 2012 +0200), but it appears
that it is being used by CLooG.  Reintroduce the symbol for backward
compatibility, but mark it "deprecated" so that it will hopefully
not be used by new users.

Reported-by: Jack Howarth <howarth@bromo.med.uc.edu>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd isl_union_map_uncurry
Sven Verdoolaege [Fri, 23 Nov 2012 14:41:24 +0000 (15:41 +0100)]
add isl_union_map_uncurry

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoconfigure.ac: check if TargetInfo::CreateTargetInfo takes TargetOptions pointer
Sven Verdoolaege [Fri, 23 Nov 2012 20:43:29 +0000 (21:43 +0100)]
configure.ac: check if TargetInfo::CreateTargetInfo takes TargetOptions pointer

Newer versions of clang take a pointer, while older versions take a reference.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agointerface/extract_interface.cc: take TargetOptions object from CompilerInstance
Sven Verdoolaege [Fri, 23 Nov 2012 20:25:11 +0000 (21:25 +0100)]
interface/extract_interface.cc: take TargetOptions object from CompilerInstance

The memory management of TargetOptions has changed in recent clangs.
Taking TargetOptions from the CompilerInstance seems to work in both
older and newer versions of clang.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoAST printing callbacks: pass isl_ast_print_options
Sven Verdoolaege [Thu, 22 Nov 2012 12:29:31 +0000 (13:29 +0100)]
AST printing callbacks: pass isl_ast_print_options

The callback may want to pass control back to isl_ast_node_*_print,
for which it needs an isl_ast_print_options object.  Since the
caller of the callback already has a reference to such an object,
we might as well pass it along to the callback.

Since the callback may want to modifiy the isl_ast_print_options
object, we turn it into a properly reference counted isl object.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agodoc: fix typo
Sven Verdoolaege [Thu, 22 Nov 2012 12:27:57 +0000 (13:27 +0100)]
doc: fix typo

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoadd before_each_for/after_each_for callbacks
Sven Verdoolaege [Tue, 20 Nov 2012 19:22:35 +0000 (20:22 +0100)]
add before_each_for/after_each_for callbacks

11 years agoisl_ast_build_from_context: allow unnamed set dimensions
Sven Verdoolaege [Sat, 10 Nov 2012 15:46:06 +0000 (16:46 +0100)]
isl_ast_build_from_context: allow unnamed set dimensions

The original code would assume all dimensions have an associated isl_id.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_basic_map_gist: drop irrelevant constraints from the context
Sven Verdoolaege [Sun, 18 Nov 2012 08:24:50 +0000 (09:24 +0100)]
isl_basic_map_gist: drop irrelevant constraints from the context

The context may contain constraints on variables that do not even
appear in the input basic map.  The constraints therefore cannot
be exploited to simplify the input and only serve to make some
of the internal computations more expensive, in particular the
computation of the affine hull of the intersection of input and context
and the emptiness checks used in the final determination of
the redundancy of a constraint.
It's therefore more efficient to remove those irrelevant constraints.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_map_simplify.c: fix typo in comment
Sven Verdoolaege [Tue, 20 Nov 2012 16:53:57 +0000 (17:53 +0100)]
isl_map_simplify.c: fix typo in comment

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_ast_build_eliminate_divs: remove unknown divs before divs involving depth
Sven Verdoolaege [Tue, 20 Nov 2012 14:39:39 +0000 (15:39 +0100)]
isl_ast_build_eliminate_divs: remove unknown divs before divs involving depth

Occasionally, eliminating unknown divs may turn other unknown divs
into known divs, which may depend on the current depth.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_affine_hull.c: affine_hull_with_cone: plug memory leak on error path
Sven Verdoolaege [Sat, 17 Nov 2012 12:28:18 +0000 (13:28 +0100)]
isl_affine_hull.c: affine_hull_with_cone: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agochange prototype of isl_factorizer_dump
Sven Verdoolaege [Sat, 17 Nov 2012 12:27:38 +0000 (13:27 +0100)]
change prototype of isl_factorizer_dump

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_tab_sample: perform greedy search before performing basis reduction
Sven Verdoolaege [Mon, 19 Nov 2012 11:25:11 +0000 (12:25 +0100)]
isl_tab_sample: perform greedy search before performing basis reduction

While basis reduction is very useful on difficult problems, it is
overkill on easy problems.  In fact, the basis reduction computation
can be quite expensive, especially in the presence of large coefficients.
This may happen in particular during the affine hull computation
when only a few sample points have been found so far.  If these
points have large values, then the equalities that describe their
affine hull may have coefficients with larger values still.

Perform a greedy search before computing a reduced basis.
We also perform a greedy search after computing the reduced basis
just in case the problem has become easy through this basis reduction.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_tab_sample: extract out compute_min and compute_max
Sven Verdoolaege [Tue, 20 Nov 2012 10:41:42 +0000 (11:41 +0100)]
isl_tab_sample: extract out compute_min and compute_max

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

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_tab_sample: treat emptiness of tableau as error
Sven Verdoolaege [Tue, 20 Nov 2012 10:19:00 +0000 (11:19 +0100)]
isl_tab_sample: treat emptiness of tableau as error

We only modify the tableau through calls to isl_tab_add_valid_eq,
which should never result in an empty tableau, given that
the tableau was initially not empty.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoAST generation: fix handling of separation classes
Sven Verdoolaege [Fri, 16 Nov 2012 15:29:04 +0000 (16:29 +0100)]
AST generation: fix handling of separation classes

In particular, make sure that the classes remain separate.
After removing the previous classes from the current class,
we would intersect the result with the schedule domain
and then eliminate inner dimensions.  This elimination process
may drop some constraints that are needed to ensure that the
current class is disjoint from the previous classes.
We therefore intersect the result of the elimination step
with the current separation class domain.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_printer_print_{basic_,}{set,map}: don't start new line in omega format
Sven Verdoolaege [Mon, 1 Oct 2012 09:24:49 +0000 (11:24 +0200)]
isl_printer_print_{basic_,}{set,map}: don't start new line in omega format

For the isl format, the new line was removed in 9a54ed5
(isl_printer_print_basic_{set,map}: don't start new line in isl format,
Sun Feb 13 09:05:48 2011 +0100).

Additionally, remove the parameter declaration.
Printing out the parameter declaration for each (basic) set or map
is not very convenient.  Instead, we now support printing the parameter
declaration through isl_printer_print_space.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_printer_print_space: support printing in "omega" format
Sven Verdoolaege [Mon, 1 Oct 2012 09:18:04 +0000 (11:18 +0200)]
isl_printer_print_space: support printing in "omega" format

In particular, print a declaration for the parameters in the space.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agorename isl_basic_set_add to isl_basic_set_add_dims
Sven Verdoolaege [Mon, 1 Oct 2012 08:55:08 +0000 (10:55 +0200)]
rename isl_basic_set_add to isl_basic_set_add_dims

For consistency with isl_set_add_dims and isl_basic_set_insert_dims.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_aff_normalize: plug in divs with unit coefficient in other divs
Sven Verdoolaege [Sat, 29 Sep 2012 18:11:32 +0000 (20:11 +0200)]
isl_aff_normalize: plug in divs with unit coefficient in other divs

The outer div expression can then be simplified and the inner div
expression may be removed if it was only used inside the outer div
expression.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_local_space_substitute_seq: take argument for the number of divs to modify
Sven Verdoolaege [Sat, 29 Sep 2012 17:45:57 +0000 (19:45 +0200)]
isl_local_space_substitute_seq: take argument for the number of divs to modify

This will allow us to modify a single div in the next commit.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_aff_floor: normalize result
Sven Verdoolaege [Sat, 8 Sep 2012 13:04:45 +0000 (15:04 +0200)]
isl_aff_floor: normalize result

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_aff_ceil: compute ceil(e/m) as floor((e + m - 1)/m)
Sven Verdoolaege [Sat, 8 Sep 2012 12:56:40 +0000 (14:56 +0200)]
isl_aff_ceil: compute ceil(e/m) as floor((e + m - 1)/m)

The original implementation would compute ceil(e/m) as -floor(-e/m).
Although both are correct, floor((e + m - 1)/m) is probably less
surprising.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_aff_gist: add missing isl_vec_cow
Sven Verdoolaege [Mon, 12 Nov 2012 11:13:15 +0000 (12:13 +0100)]
isl_aff_gist: add missing isl_vec_cow

We could end up modifying a different isl_aff that originated from
the same isl_aff as the one being modified.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_union_set_compute_schedule: double check that we do not run out of rows
Sven Verdoolaege [Sun, 4 Nov 2012 15:51:30 +0000 (16:51 +0100)]
isl_union_set_compute_schedule: double check that we do not run out of rows

The previous commit fixed a case where we would generate more schedule
rows than anticipated.  Make sure we do not run into this situation again.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoisl_union_set_compute_schedule: ensure carry_dependences makes progress
Sven Verdoolaege [Sun, 4 Nov 2012 15:30:54 +0000 (16:30 +0100)]
isl_union_set_compute_schedule: ensure carry_dependences makes progress

If solve_lp is unable to find a solution, then compute_schedule_wcc
calls carry_dependences to carry as many dependences as possible.

However, the reason that solve_lp was unable to find a solution
may be due to proximity dependences.  In particular, if there are
an infinite number of dependences with the same starting or ending
itereration, then the way proximity dependences are currently handled
may force some of the schedule coefficients to be zero based solely
on those proximity dependences.

carry_dependences may then fail to carry any (validity) dependences
simply because there are no validity dependences.
More generally, it may produce a non-trivial solution on only some
of the nodes.  This may result in a number of schedule rows (infinite
in the worst case) that is larger than the maximum computed in
compute_max_row, leading to out-of-bounds accesses.

We therefore check that the schedule row computed by carry_dependences
is non-trivial on all the nodes where it should be non-trivial.
If not, we try again on each dependence graph component separately
or fail if there is only one component.

Note that this commit does not fix the problem that the presence
of proximity dependences may eliminate some valid solutions,
but it should solve the out-of-bounds accesses.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
11 years agoupdate for change in clang's DiagnosticOptions
Sven Verdoolaege [Tue, 30 Oct 2012 22:15:41 +0000 (23:15 +0100)]
update for change in clang's DiagnosticOptions

DiagnosticOptions was moved from Frontend to Basic and
createDiagnostics now takes a pointer to a DiagnosticOptions object.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_map_plain_is_disjoint: handle inputs with different parameters
Sven Verdoolaege [Sun, 14 Oct 2012 14:38:21 +0000 (16:38 +0200)]
isl_map_plain_is_disjoint: handle inputs with different parameters

In particular, make sure we do not call isl_basic_map_plain_is_disjoint
if the input relations do not have the same parameters.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd README
Sven Verdoolaege [Sat, 13 Oct 2012 12:04:19 +0000 (14:04 +0200)]
add README

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoIntroduce isl_int_free_str to remove GMP dependency in isl_int interface
Andreas Kloeckner [Mon, 8 Oct 2012 17:36:50 +0000 (13:36 -0400)]
Introduce isl_int_free_str to remove GMP dependency in isl_int interface

Signed-off-by: Andreas Kloeckner <inform@tiker.net>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_union_set_compute_schedule: handle result with zero bands
Sven Verdoolaege [Wed, 10 Oct 2012 10:36:37 +0000 (12:36 +0200)]
isl_union_set_compute_schedule: handle result with zero bands

The code in extract_schedule would assume that there is at least
one band in the resulting schedule.  Skip the parts that depend
on this assumption when the number of bands is zero.

Reported-by: Sameer Sahasrabuddhe <Sameer.Sahasrabuddhe@amd.com>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_ast_codegen.c: generate_domain: postpone single-valuedness test
Sven Verdoolaege [Sun, 7 Oct 2012 10:18:45 +0000 (12:18 +0200)]
isl_ast_codegen.c: generate_domain: postpone single-valuedness test

In particular, perform the test on the map that will actually be used
to construct the call expression.

The original code would first perform the test and then construct
the call expression from a map with a simplified domain.
This construction may fail because after simplification of the domain,
the map may no longer be single valued.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_ast_build_ast_from_schedule: make construction of else branches optional
Sven Verdoolaege [Fri, 5 Oct 2012 12:15:20 +0000 (14:15 +0200)]
isl_ast_build_ast_from_schedule: make construction of else branches optional

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_ast_build_ast_from_schedule: use "<" if upper bound has negative constant
Sven Verdoolaege [Tue, 2 Oct 2012 11:30:25 +0000 (13:30 +0200)]
isl_ast_build_ast_from_schedule: use "<" if upper bound has negative constant

This is a purely cosmetic change.
In particular, we prefer

    for (int c1 = max(0, c0); c1 < min(N, N + c0); c1 += 1)

over

    for (int c1 = max(0, c0); c1 <= min(N - 1, N + c0 - 1); c1 += 1)

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_ast_expr: add isl_ast_op_lt and isl_ast_op_gt operations
Sven Verdoolaege [Tue, 2 Oct 2012 11:20:24 +0000 (13:20 +0200)]
isl_ast_expr: add isl_ast_op_lt and isl_ast_op_gt operations

isl_ast_op_lt will be useful in the next commit.
isl_ast_op_gt is added for consistency.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd isl_basic_set_from_params
Sven Verdoolaege [Mon, 1 Oct 2012 08:52:00 +0000 (10:52 +0200)]
add isl_basic_set_from_params

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_ast_expr_from_aff: try harder to use isl_ast_op_pdiv_{q,r}
Sven Verdoolaege [Fri, 28 Sep 2012 18:19:01 +0000 (20:19 +0200)]
isl_ast_expr_from_aff: try harder to use isl_ast_op_pdiv_{q,r}

When generating C code, we prefer to generate "/" (or "%") rather
than "floord" because "floord" has an implicit condition on the
sign of the first argument.
We would already generate isl_ast_op_pdiv_q instead of isl_ast_op_fdiv_q
if we detect that the first argument is non-negative.
Now, we also check if the first argument is smaller than the second.
If so, we can rewrite

floor(e/d) = -ceil(-e/d) = -floor((-e + d - 1)/d)

and still use isl_ast_op_pdiv_q.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_ast_build_expr.c: separate out extract_modulo function
Sven Verdoolaege [Sat, 29 Sep 2012 08:18:55 +0000 (10:18 +0200)]
isl_ast_build_expr.c: separate out extract_modulo function

This will make it easier to improve the extraction of modulos
in a subsequent commit.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_ast_build_expr.c: fix typo in comment
Sven Verdoolaege [Sat, 29 Sep 2012 10:02:01 +0000 (12:02 +0200)]
isl_ast_build_expr.c: fix typo in comment

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_ast_build_expr.c: remove remnants of code removed before inclusion
Sven Verdoolaege [Sat, 29 Sep 2012 09:11:19 +0000 (11:11 +0200)]
isl_ast_build_expr.c: remove remnants of code removed before inclusion

The AST generation code has undergone many changes before it was
included in the master branch.  Some references to old code got left in
by mistake.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd extra AST generation test case from CLooG
Sven Verdoolaege [Fri, 28 Sep 2012 17:36:50 +0000 (19:36 +0200)]
add extra AST generation test case from CLooG

The test case was not added before because the output had not been
tested yet.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_printer_print_str: handle NULL input
Sven Verdoolaege [Fri, 21 Sep 2012 19:57:19 +0000 (21:57 +0200)]
isl_printer_print_str: handle NULL input

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_ast_expr_mod: perform missing multiplication
Sven Verdoolaege [Fri, 21 Sep 2012 16:11:07 +0000 (18:11 +0200)]
isl_ast_expr_mod: perform missing multiplication

The function was documented as multiplying the constructed modulo expression
by the first argument, but failed to do so.
The problem went unnoticed because the first argument is usually equal to 1.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoMake sed expression in Makefile compatible with BSD style sed
Tobias Grosser [Fri, 21 Sep 2012 10:50:08 +0000 (12:50 +0200)]
Make sed expression in Makefile compatible with BSD style sed

Apparently sed as available on Mac, requires a terminating semicolon
in the command list. As gnu-sed is OK with and without the semicolon
we add it for compatibility.

Note that the "{" command of historical seds may not support multiple
commands on a single line.

Reported-by: Georg <georggcc@googlemail.com>
Signed-off-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd isl_id_set_free_user
Sven Verdoolaege [Mon, 10 Sep 2012 12:23:40 +0000 (14:23 +0200)]
add isl_id_set_free_user

Allow the user to specify a callback to be called on the user pointer
when the last reference to the isl_id disappears.  This is convenient
for attaching dynamically allocated data structures to isl_ids,
especially in annotations to AST nodes.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_printer_print_pw_aff: use isl_ast_expr when printing in C format
Sven Verdoolaege [Mon, 14 May 2012 15:30:25 +0000 (17:30 +0200)]
isl_printer_print_pw_aff: use isl_ast_expr when printing in C format

isl_ast_expr_from_aff tries a bit harder to print a nice result,
so we might as well reuse that functionality.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd support for generating ASTs from schedule relations
Sven Verdoolaege [Mon, 17 Sep 2012 20:11:06 +0000 (22:11 +0200)]
add support for generating ASTs from schedule relations

This functionality is similar to that offered by CLooG and codegen(+).
The implementation in isl allows for a bit more control on how
the ASTs are generated by means of fairly flexible options.
It also has proper support for nested AST generation.

The outputs of all test cases have been verified by parsing them
using pet and then checking that the set of calls corresponds exactly
to the domain of the schedule and that they are called in an order
that matches the schedule.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd ISL_CTX_{GET,SET}_STR_DEF macros
Sven Verdoolaege [Mon, 17 Sep 2012 15:34:48 +0000 (17:34 +0200)]
add ISL_CTX_{GET,SET}_STR_DEF macros

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agodoc: separate out polyhedral compilation functionality
Sven Verdoolaege [Thu, 24 May 2012 17:48:01 +0000 (19:48 +0200)]
doc: separate out polyhedral compilation functionality

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd isl_set_dim_has_{lower,upper}_bound
Sven Verdoolaege [Sun, 26 Aug 2012 13:53:42 +0000 (15:53 +0200)]
add isl_set_dim_has_{lower,upper}_bound

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_basic_set_substitute: check that input affine expression is integral
Sven Verdoolaege [Thu, 1 Mar 2012 10:02:51 +0000 (11:02 +0100)]
isl_basic_set_substitute: check that input affine expression is integral

Otherwise, we may have to add stride constraints.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_pw_multi_aff_substitute: improve error handling
Sven Verdoolaege [Wed, 29 Feb 2012 16:58:47 +0000 (17:58 +0100)]
isl_pw_multi_aff_substitute: improve error handling

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_basic_map_align_divs: fix potential invalid access
Sven Verdoolaege [Sat, 3 Mar 2012 12:55:54 +0000 (13:55 +0100)]
isl_basic_map_align_divs: fix potential invalid access

isl_basic_map_align_divs is currently only called on inputs that are
known not to be NULL, but since we check whether they are NULL anyway,
we might as well only access them after this test.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_pw_multi_aff_from_map: detect strides in output dimensions
Sven Verdoolaege [Fri, 14 Sep 2012 21:43:26 +0000 (23:43 +0200)]
isl_pw_multi_aff_from_map: detect strides in output dimensions

If the input map is of the form

{ [i] -> [j] : exists a: j = 4 a and i - 1 <= j <= i }

then the detection mechanism of the previous commit will not
be able to read off the definition of j directly from the constraints.
However, if we plug in j = 4 j', we obtain

{ [i] -> [j'] : i - 1 <= 4 j' <= i }

from which we can read off j' = floor(i/4), which can then be plugged
back into j = 4 j' to obitain j = 4 * floor(i/4).

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoisl_pw_multi_aff_from_map: detect easy floors directly from constraints
Sven Verdoolaege [Tue, 11 Sep 2012 13:26:42 +0000 (15:26 +0200)]
isl_pw_multi_aff_from_map: detect easy floors directly from constraints

If the input map has constraints of the form

{ [i] -> [j] : i - 1 <= 2 j <= i }

then we can easily detect that j can be taken to be equal to floor(i / 2).
Detecting these conditions directly from the constraints saves us
from having to compute a minimum on this dimension
using parametric integer programming.  Not only can such an operation
be fairly costly, it can also lead to needless subdivisions if there
are any other constraints on the dimension to be minimized.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoprivately export isl_map_is_set
Sven Verdoolaege [Mon, 17 Sep 2012 11:58:41 +0000 (13:58 +0200)]
privately export isl_map_is_set

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd isl_pw_*_pullback_pw_multi_aff
Sven Verdoolaege [Sat, 15 Sep 2012 07:16:04 +0000 (09:16 +0200)]
add isl_pw_*_pullback_pw_multi_aff

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd isl_pw_*_pullback_multi_aff
Sven Verdoolaege [Fri, 20 Jul 2012 13:28:12 +0000 (15:28 +0200)]
add isl_pw_*_pullback_multi_aff

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd isl_multi_aff_pullback_multi_aff
Sven Verdoolaege [Fri, 20 Jul 2012 12:07:37 +0000 (14:07 +0200)]
add isl_multi_aff_pullback_multi_aff

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd isl_aff_pullback_multi_aff
Sven Verdoolaege [Fri, 20 Jul 2012 11:51:33 +0000 (13:51 +0200)]
add isl_aff_pullback_multi_aff

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd isl_local_space_preimage_multi_aff
Sven Verdoolaege [Fri, 20 Jul 2012 11:32:10 +0000 (13:32 +0200)]
add isl_local_space_preimage_multi_aff

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
12 years agoadd isl_set_preimage_pw_multi_aff
Sven Verdoolaege [Sat, 25 Aug 2012 09:18:40 +0000 (11:18 +0200)]
add isl_set_preimage_pw_multi_aff

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