[polly] r280938 - DependenceInfo: Make clear that no double-free problem exists
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 8 07:08:01 PDT 2016
Author: grosser
Date: Thu Sep 8 09:08:01 2016
New Revision: 280938
URL: http://llvm.org/viewvc/llvm-project?rev=280938&view=rev
Log:
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.
Modified:
polly/trunk/lib/Analysis/DependenceInfo.cpp
Modified: polly/trunk/lib/Analysis/DependenceInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/DependenceInfo.cpp?rev=280938&r1=280937&r2=280938&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/DependenceInfo.cpp (original)
+++ polly/trunk/lib/Analysis/DependenceInfo.cpp Thu Sep 8 09:08:01 2016
@@ -537,8 +537,10 @@ void Dependences::calculateDependences(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));
More information about the llvm-commits
mailing list