isl_basic_map_reduce_coefficients: only modify a single copy of input
isl_basic_map_reduce_coefficients may leave the input basic map
in a state where the constraints are not gaussed.
This is not so much a problem in the context where it is called,
because isl_map_coalesce will make sure that the basic maps
in its final results are gaussed.
However, the basic map modified by isl_basic_map_reduce_coefficients
may be shared with other maps and they would also see their
constraints modified and left in a possibly inconsistent state.
One solution would be to call isl_basic_map_gauss unconditionally
on the output of isl_basic_map_reduce_coefficients, but this would
result in some failing test cases because isl_map_coalesce actually
depends on the inconsistent state in order to pass these tests.
It would be possible to simply disable these tests, but
since this commit is meant as a bug-fix, this is not a satisfactory
outcome.
The solution taken by this commit is to only perform
the constraint modifications on a single copy of the constraints.
This ensures that other copies are not affected, but still
allows isl_map_coalesce to pass its tests successfully.
This change does raise questions about the usefulness of
the ISL_BASIC_MAP_REDUCED_COEFFICIENTS flag, since it now becomes
clear that this flag only covers part of the effect of the function.
Since the flag is now only set on a single copy, it is not very likely
that it will help to reduce duplicate computations and when it does,
the output may be different because it will leave the input
in its default gaussed state.
However, changes to this flag or to how it is treated
are beyond the scope of a bug-fix.
Reported-by: Siddharth Bhat <siddu.druid@gmail.com>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>