isl_scheduler.c: extract_edge: simplify code
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Tue, 25 Jul 2017 11:40:34 +0000 (25 13:40 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Fri, 14 May 2021 22:16:01 +0000 (15 00:16 +0200)
In particular, reorganize the code such that it only has
a single call to graph_edge_table_add.
This simplifies the next commit.

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

index 9bbc271..d714409 100644 (file)
@@ -1676,10 +1676,8 @@ static isl_stat extract_edge(__isl_take isl_map *map, void *user)
                return isl_stat_error;
        }
        if (edge == &graph->edge[graph->n_edge])
-               return graph_edge_table_add(ctx, graph, data->type,
-                                   &graph->edge[graph->n_edge++]);
-
-       if (merge_edge(edge, &graph->edge[graph->n_edge]) < 0)
+               edge = &graph->edge[graph->n_edge++];
+       else if (merge_edge(edge, &graph->edge[graph->n_edge]) < 0)
                return isl_stat_error;
 
        return graph_edge_table_add(ctx, graph, data->type, edge);