isl_union_map_params: plug memory leak in case of empty input

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_ctx.c: find_nested_options: properly handle argument "groups"

An argument group is encoded as a child with an offset of -1 and
we are obviously not allowed to use this -1 as an offset.
Instead, the structure holding the child options is the same as
that of the parent.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_ast_build_ast_from_schedule: improve handling of unroll options

The core algorithm assumes that the result of compute_domains consists
of disjoint domains and may end up in an infinite recursion if they
overlap.  As in the case of atomic domains, the unroll domais may
actually be larger than those specified by the user because some
constraints may be simplified away.  In combination with separation
classes, this may result in the unroll domains in one class overlapping
with the unroll domains in another class.

We therefore now compute the unroll domains earlier and we intersect
them with the class domain again to ensure that the result does not
overlap with other classes.  We also update the class domain to
reflect the atomic and unroll domains so that these would not overlap
with other domains within the same class domain.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
MinGW-w64 build fix (lacks ffs declaration)

Define ffs as __builtin_ffs if ffs is not declared but
__builtin_ffs is declared.

This problem only happens at -O0 as one of the optimization
passes substitutes ffs for __builtin_ffs.

Signed-off-by: Ray Donnelly <mingw.android@gmail.com>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>