From fca21e98ce8620180266d466a6ab2da617dd4d7c Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 2 Jun 2021 16:12:19 +0200 Subject: [PATCH] isl_aff_remove_unused_divs: reuse isl_aff_drop_dims This removes some code duplication and prepares for the next commit. Signed-off-by: Sven Verdoolaege --- isl_aff.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/isl_aff.c b/isl_aff.c index 2d57075a..49496640 100644 --- a/isl_aff.c +++ b/isl_aff.c @@ -1485,17 +1485,8 @@ __isl_give isl_aff *isl_aff_remove_unused_divs(__isl_take isl_aff *aff) return isl_aff_free(aff); pos = isl_seq_last_non_zero(aff->v->el + 1 + 1 + v_div, n) + 1; - if (pos == n) - return aff; - - aff = isl_aff_cow(aff); - if (!aff) - return NULL; - - aff->ls = isl_local_space_drop_dims(aff->ls, isl_dim_div, pos, n - pos); - aff->v = isl_vec_drop_els(aff->v, 1 + 1 + v_div + pos, n - pos); - if (!aff->ls || !aff->v) - return isl_aff_free(aff); + if (pos < n) + aff = isl_aff_drop_dims(aff, isl_dim_div, pos, n - pos); return aff; } -- 2.11.4.GIT