summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis/Dependences.cpp
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2011-08-20 11:11:25 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2011-08-20 11:11:25 +0000
commitb76f385334405e6517ee60b5dfdf569ff4e94f1f (patch)
treef1bd4056fc00da863dd7ebdbb9967686883329ca /polly/lib/Analysis/Dependences.cpp
parent15f5efff8f44ccbb3c1f184bbd858c2b7ff5be4f (diff)
downloadbcm5719-llvm-b76f385334405e6517ee60b5dfdf569ff4e94f1f.tar.gz
bcm5719-llvm-b76f385334405e6517ee60b5dfdf569ff4e94f1f.zip
Free isl_ctx and fix several memory leaks
Because of me not understanding the LLVM pass structure well, I did not find a good way to allocate isl_ctx and to free it later without getting issues with reference counting. I now found this place, such that we can free isl_ctx. This patch also fixes the memory leaks that were ignored beforehand. llvm-svn: 138204
Diffstat (limited to 'polly/lib/Analysis/Dependences.cpp')
-rw-r--r--polly/lib/Analysis/Dependences.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/polly/lib/Analysis/Dependences.cpp b/polly/lib/Analysis/Dependences.cpp
index 6e465e528cd..c9c2351fc97 100644
--- a/polly/lib/Analysis/Dependences.cpp
+++ b/polly/lib/Analysis/Dependences.cpp
@@ -213,25 +213,32 @@ bool Dependences::isValidScattering(StatementToIslMapTy *NewScattering) {
temp_must_no_source = isl_union_map_coalesce(temp_must_no_source);
temp_may_no_source = isl_union_map_coalesce(temp_may_no_source);
+ bool isValid = true;
+
if (!isl_union_map_is_equal(temp_must_dep, must_dep)) {
DEBUG(dbgs().indent(4) << "\nEqual 1 calculated\n");
- return false;
+ isValid = false;
}
DEBUG(dbgs().indent(4) << "\nEqual 1 calculated\n");
if (!isl_union_map_is_equal(temp_may_dep, may_dep))
- return false;
+ isValid = false;
DEBUG(dbgs().indent(4) << "\nEqual 2 calculated\n");
if (!isl_union_map_is_equal(temp_must_no_source, must_no_source))
- return false;
+ isValid = false;
if (!isl_union_map_is_equal(temp_may_no_source, may_no_source))
- return false;
+ isValid = false;
+
+ isl_union_map_free(temp_must_dep);
+ isl_union_map_free(temp_may_dep);
+ isl_union_map_free(temp_must_no_source);
+ isl_union_map_free(temp_may_no_source);
- return true;
+ return isValid;
}
isl_union_map* getCombinedScheduleForDim(Scop *scop, unsigned dimLevel) {
@@ -278,8 +285,7 @@ bool Dependences::isParallelDimension(isl_set *loopDomain,
scheduleDeps_waw = isl_union_map_apply_range(isl_union_map_copy(waw_dep),
isl_union_map_copy(schedule));
- scheduleDeps_waw = isl_union_map_apply_domain(scheduleDeps_waw,
- isl_union_map_copy(schedule));
+ scheduleDeps_waw = isl_union_map_apply_domain(scheduleDeps_waw, schedule);
// Dependences need to originate and to terminate in the scheduling space
// enumerated by this loop.
@@ -300,7 +306,7 @@ bool Dependences::isParallelDimension(isl_set *loopDomain,
restrictedDeps_waw = isl_union_map_intersect_domain(scheduleDeps_waw,
isl_union_set_copy(scheduleSubset));
restrictedDeps_waw = isl_union_map_intersect_range(restrictedDeps_waw,
- isl_union_set_copy(scheduleSubset));
+ scheduleSubset);
isl_union_set *distance_waw = isl_union_map_deltas(restrictedDeps_waw);
@@ -353,10 +359,16 @@ bool Dependences::isParallelDimension(isl_set *loopDomain,
isl_union_set *nonValid_waw = isl_union_set_subtract(distance_waw,
validDistancesUS);
-
- return isl_union_set_is_empty(nonValid)
+ bool is_parallel = isl_union_set_is_empty(nonValid)
&& isl_union_set_is_empty(nonValid_war)
&& isl_union_set_is_empty(nonValid_waw);
+
+ isl_dim_free(dim);
+ isl_union_set_free(nonValid);
+ isl_union_set_free(nonValid_war);
+ isl_union_set_free(nonValid_waw);
+
+ return is_parallel;
}
bool Dependences::isParallelFor(const clast_for *f) {
OpenPOWER on IntegriCloud