[polly] r278062 - [ScopDetection] Remove unused DetectionContexts during expansion.
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 8 15:39:32 PDT 2016
Author: meinersbur
Date: Mon Aug 8 17:39:32 2016
New Revision: 278062
URL: http://llvm.org/viewvc/llvm-project?rev=278062&view=rev
Log:
[ScopDetection] Remove unused DetectionContexts during expansion.
The function expandRegion() frees Region* objects again when it determines that
these are not valid SCoPs. However, the DetectionContext added to the
DetectionContextMap still holds a reference. The validity is checked using the
ValidRegions lookup table. When a new Region is added to that list, it might
share the same address, such that the DetectionContext contains two
Region* associations that are in ValidRegions, but that are unrelated and of
which one has already been free.
Also remove the DetectionContext when not a valid expansion.
Modified:
polly/trunk/lib/Analysis/ScopDetection.cpp
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=278062&r1=278061&r2=278062&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Mon Aug 8 17:39:32 2016
@@ -1151,12 +1151,16 @@ Region *ScopDetection::expandRegion(Regi
// - if false, .tbd. => stop (should this really end the loop?)
if (!allBlocksValid(Context) || Context.Log.hasErrors()) {
removeCachedResults(*ExpandedRegion);
+ DetectionContextMap.erase(It.first);
break;
}
// Store this region, because it is the greatest valid (encountered so
// far).
- removeCachedResults(*LastValidRegion);
+ if (LastValidRegion) {
+ removeCachedResults(*LastValidRegion);
+ DetectionContextMap.erase(getBBPairForRegion(LastValidRegion.get()));
+ }
LastValidRegion = std::move(ExpandedRegion);
// Create and test the next greater region (if any)
@@ -1166,6 +1170,7 @@ Region *ScopDetection::expandRegion(Regi
} else {
// Create and test the next greater region (if any)
removeCachedResults(*ExpandedRegion);
+ DetectionContextMap.erase(It.first);
ExpandedRegion =
std::unique_ptr<Region>(ExpandedRegion->getExpandedRegion());
}
More information about the llvm-commits
mailing list