isl_union_set_compute_schedule: fix check for progress in carry_dependences

Commit 6b21b75 (isl_union_set_compute_schedule: ensure carry_dependences
makes progress, Sun Nov 4 16:30:54 2012 +0100) introduced a test
for trivial solutions in order to avoid recomputing the same trivial
solution over and over, but it failed to take into account that
the coefficients computed in carry_dependences correspond to
the original iterators and not on the result of a change of basis.
As a result the test could mistakenly flag some perfectly fine solutions
as trivial and vice versa.
Fix the test by performing the change of basis on the computed solution.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_*_list_add: do not modify lists in-place

isl_*_list_add calls isl_*_list_grow to ensure that there is room
for at least one more element and then directly modifies the
returned list.  If the original list was large enough already, then
isl_*_list_grow will simply return this list, even if there
is more than one reference to the list, resulting in
isl_*_list_add also modifying the other references to the original list.

We could just add a call to isl_*_list_cow in isl_*_list_add,
but that could result in the list getting copied twices.
Instead, we make sure that isl_*_list_grow always returns
a list with a single reference.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
python interface: also convert first argument to correct type

If a method is invoked on an object of a class that does not
override the method defined by a superclass, then the method
of the superclass method will be invoked on a reference to a
C object that corresponds to the subclass.  This object then
also needs to be explicitly converted to the superclass just
like any other argument of the method.

In particular, the foreach_set method of union_set is not
overriden by set and therefore may get called on an object
that is actually of type set.

Reported-by: Armin Größlinger <armin.groesslinger@uni-passau.de>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>