>>> + { >>> + isl_dim *dc = isl_set_get_dim (scop->context); >>> + int nb_in = isl_dim_size (dc, isl_dim_set); >>> + int nb_out = 1 + DR_NUM_DIMENSIONS (dr); >>> + int nbp = scop_nb_params (scop); >>> + isl_dim *dim = isl_dim_alloc (scop->ctx, nbp, nb_in, nb_out); >>> + int i; >>> + >>> + for (i = 0; i < nbp; i++) >>> + dim = isl_dim_set_dim_id (dim, isl_dim_param, i, >>> + isl_dim_get_dim_id (dc, isl_dim_param, i)); >>> + for (i = 0; i < nb_in; i++) >>> + dim = isl_dim_set_dim_id (dim, isl_dim_in, i, >>> + isl_dim_get_dim_id (dc, isl_dim_set, i)); >> >> This is dangerous too. Why don't you derive dim directly from dc >> instead of creating a fresh dim and then trying to copy some information? > > Yes, thanks for pointing this out. I will fix this.
I am confused on this one: which function should I use to create dim from dc? I don't see how to specify the number of input and output dimensions like the isl_dim_alloc would do. What do you think about copying only the parameters from scop->context? { isl_dim *dc = isl_set_get_dim (scop->context); int nb_in = isl_dim_size (dc, isl_dim_set); int nb_out = 1 + DR_NUM_DIMENSIONS (dr); int nbp = scop_nb_params (scop); isl_dim *dim = isl_dim_alloc (scop->ctx, nbp, nb_in, nb_out); int i; for (i = 0; i < nbp; i++) dim = isl_dim_set_dim_id (dim, isl_dim_param, i, isl_dim_get_dim_id (dc, isl_dim_param, i)); acc = isl_map_universe (dim); acc = isl_map_set_tuple_id (acc, isl_dim_out, isl_id_for_dr (scop, dr)); isl_dim_free (dc); } Would this be ok? Thanks, Sebastian