isl_map_range: optimize case where the number of input dimensions is zero
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 14 Mar 2010 21:07:48 +0000 (22:07 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 14 Mar 2010 21:07:48 +0000 (22:07 +0100)
isl_map.c

index b481a05..6d8ded1 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -3082,16 +3082,17 @@ struct isl_set *isl_map_range(struct isl_map *map)
 
        if (!map)
                goto error;
+       if (isl_map_dim(map, isl_dim_in) == 0)
+               return (isl_set *)map;
+
        map = isl_map_cow(map);
        if (!map)
                goto error;
 
        set = (struct isl_set *) map;
-       if (set->dim->n_in != 0) {
-               set->dim = isl_dim_drop_inputs(set->dim, 0, set->dim->n_in);
-               if (!set->dim)
-                       goto error;
-       }
+       set->dim = isl_dim_drop_inputs(set->dim, 0, set->dim->n_in);
+       if (!set->dim)
+               goto error;
        for (i = 0; i < map->n; ++i) {
                set->p[i] = isl_basic_map_range(map->p[i]);
                if (!set->p[i])