isl_map_intersect currently doubles as a isl_map_intersect_params
and in this capacity, the spaces of the two arguments may be different.
In this case, we need to make sure that we return an (empty) map
in the correct space.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
if (!map1 || !map2)
goto error;
- if (isl_map_plain_is_empty(map1)) {
+ if (isl_map_plain_is_empty(map1) &&
+ isl_dim_equal(map1->dim, map2->dim)) {
isl_map_free(map2);
return map1;
}
- if (isl_map_plain_is_empty(map2)) {
+ if (isl_map_plain_is_empty(map2) &&
+ isl_dim_equal(map1->dim, map2->dim)) {
isl_map_free(map1);
return map2;
}