summaryrefslogtreecommitdiff
path: root/isl_flow.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-10-26 15:39:46 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-10-26 15:40:12 +0900
commit9d104ec326ac98e2a335cb3477a6ad2c2f0c87df (patch)
tree740d8e283e6dbf5713dfe12e920b0a724e802a35 /isl_flow.c
parent1bc80b1e1cf5941b141ce5c51162d6bd75c071f5 (diff)
downloadisl-9d104ec326ac98e2a335cb3477a6ad2c2f0c87df.tar.gz
isl-9d104ec326ac98e2a335cb3477a6ad2c2f0c87df.tar.bz2
isl-9d104ec326ac98e2a335cb3477a6ad2c2f0c87df.zip
Imported Upstream version 0.13upstream/0.13
Change-Id: I7cc83b826345ba2d53631534ce803771a505f7f0 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'isl_flow.c')
-rw-r--r--isl_flow.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/isl_flow.c b/isl_flow.c
index 68fa0d9a..a263d95f 100644
--- a/isl_flow.c
+++ b/isl_flow.c
@@ -127,7 +127,8 @@ error:
return NULL;
}
-void *isl_restriction_free(__isl_take isl_restriction *restr)
+__isl_null isl_restriction *isl_restriction_free(
+ __isl_take isl_restriction *restr)
{
if (!restr)
return NULL;
@@ -227,7 +228,8 @@ error:
/* Free the given isl_access_info structure.
*/
-void *isl_access_info_free(__isl_take isl_access_info *acc)
+__isl_null isl_access_info *isl_access_info_free(
+ __isl_take isl_access_info *acc)
{
int i;
@@ -373,7 +375,7 @@ static __isl_give isl_space *space_align_and_join(__isl_take isl_space *left,
*/
static __isl_give isl_flow *isl_flow_alloc(__isl_keep isl_access_info *acc)
{
- int i;
+ int i, n;
struct isl_ctx *ctx;
struct isl_flow *dep;
@@ -385,12 +387,12 @@ static __isl_give isl_flow *isl_flow_alloc(__isl_keep isl_access_info *acc)
if (!dep)
return NULL;
- dep->dep = isl_calloc_array(ctx, struct isl_labeled_map,
- 2 * acc->n_must + acc->n_may);
- if (!dep->dep)
+ n = 2 * acc->n_must + acc->n_may;
+ dep->dep = isl_calloc_array(ctx, struct isl_labeled_map, n);
+ if (n && !dep->dep)
goto error;
- dep->n_source = 2 * acc->n_must + acc->n_may;
+ dep->n_source = n;
for (i = 0; i < acc->n_must; ++i) {
isl_space *dim;
dim = space_align_and_join(
@@ -1143,7 +1145,7 @@ static __isl_give struct isl_sched_info *sched_info_alloc(
return NULL;
info->is_cst = isl_alloc_array(ctx, int, n);
info->cst = isl_vec_alloc(ctx, n);
- if (!info->is_cst || !info->cst)
+ if (n && (!info->is_cst || !info->cst))
goto error;
for (i = 0; i < n; ++i) {
@@ -1319,7 +1321,8 @@ static int compute_flow(__isl_take isl_map *map, void *user)
data->accesses = isl_access_info_alloc(isl_map_copy(map),
data->sink_info, &before, data->count);
- if (!data->sink_info || !data->source_info || !data->accesses)
+ if (!data->sink_info || (data->count && !data->source_info) ||
+ !data->accesses)
goto error;
data->count = 0;
data->must = 1;