isl_basic_map_align_divs: use number of local variables consistently
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Mon, 20 May 2024 10:53:25 +0000 (20 12:53 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Sat, 25 May 2024 13:04:53 +0000 (25 15:04 +0200)
Commit isl-0.20-496-g86f3bb74c1 (isl_map.c: find_div: reserve negative
return value for failures, Fri Aug 26 10:32:12 2016 +0200) introduced
a local variable to hold the number of local variables
in the destination basic map, but this same number was already
being read off directly from the basic map.
Consistently use the local variable.
This means it needs to be updated before it is used.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
isl_map.c

index 43ea9b6..0001f33 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -10364,9 +10364,9 @@ __isl_give isl_basic_map *isl_basic_map_align_divs(
                        j = isl_basic_map_alloc_div(dst);
                        if (j < 0)
                                return isl_basic_map_free(dst);
-                       isl_seq_cpy(dst->div[j], src->div[i], 1+1+v_div+i);
-                       isl_seq_clr(dst->div[j]+1+1+v_div+i, dst->n_div - i);
                        dst_n_div++;
+                       isl_seq_cpy(dst->div[j], src->div[i], 1+1+v_div+i);
+                       isl_seq_clr(dst->div[j]+1+1+v_div+i, dst_n_div - i);
                        dst = isl_basic_map_add_div_constraints(dst, j);
                        if (!dst)
                                return isl_basic_map_free(dst);