isl_union_pw_qpolynomial_add_pw_qpolynomial: don't add empty parts
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 7 Aug 2010 13:26:11 +0000 (15:26 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Wed, 18 Aug 2010 13:14:05 +0000 (15:14 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_union_templ.c

index 8495cbf..5f50ffe 100644 (file)
@@ -108,9 +108,17 @@ __isl_give UNION *FN(FN(UNION,add),PARTS)(__isl_take UNION *u,
        uint32_t hash;
        struct isl_hash_table_entry *entry;
 
+       if (!part)
+               goto error;
+
+       if (FN(PART,is_zero)(part)) {
+               FN(PART,free)(part);
+               return u;
+       }
+
        u = FN(UNION,cow)(u);
 
-       if (!part || !u)
+       if (!u)
                goto error;
 
        isl_assert(u->dim->ctx, isl_dim_match(part->dim, isl_dim_param, u->dim,