mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-13 19:32:41 +00:00
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:
parent
042a3f209b
commit
adfc971820
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user