DependenceInfo: Make clear that no double-free problem exists

When running the clang static analyser to check for memory issues, this code
originally showed a double free, as the analyser was unable to understand that
isl_union_map_free always returns NULL and consequently later uses of the isl
object we just freed will never be reached. Without this knowledge, the analyser
has to issue a warning.

We refactor the code to make it clear that for empty maps the current loop
iteration is aborted.

llvm-svn: 280938
This commit is contained in:
Tobias Grosser 2016-09-08 14:08:01 +00:00
parent 042a3f209b
commit adfc971820

View File

@ -537,8 +537,10 @@ void Dependences::calculateDependences(Scop &S) {
isl_set *AccDomW = isl_map_wrap(MA->getAccessRelation());
isl_union_map *AccRedDepU = isl_union_map_intersect_domain(
isl_union_map_copy(TC_RED), isl_union_set_from_set(AccDomW));
if (isl_union_map_is_empty(AccRedDepU) && !isl_union_map_free(AccRedDepU))
if (isl_union_map_is_empty(AccRedDepU)) {
isl_union_map_free(AccRedDepU);
continue;
}
isl_map *AccRedDep = isl_map_from_union_map(AccRedDepU);
RED_SIN = isl_union_map_add_map(RED_SIN, isl_map_copy(AccRedDep));