summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis/ScopDetection.cpp
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2016-08-08 22:39:32 +0000
committerMichael Kruse <llvm@meinersbur.de>2016-08-08 22:39:32 +0000
commita6cc0d3a2d4e217036623496f6f269694bb56464 (patch)
tree3c2f0f5a5002b4e10c7badcc9c381eeac7faa6e8 /polly/lib/Analysis/ScopDetection.cpp
parent52930b5f4acb2eba288bf4b2cf2cdd499524adb0 (diff)
downloadbcm5719-llvm-a6cc0d3a2d4e217036623496f6f269694bb56464.tar.gz
bcm5719-llvm-a6cc0d3a2d4e217036623496f6f269694bb56464.zip
[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. llvm-svn: 278062
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 433a72f6aea..95995bbd4f1 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -1151,12 +1151,16 @@ Region *ScopDetection::expandRegion(Region &R) {
// - 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(Region &R) {
} else {
// Create and test the next greater region (if any)
removeCachedResults(*ExpandedRegion);
+ DetectionContextMap.erase(It.first);
ExpandedRegion =
std::unique_ptr<Region>(ExpandedRegion->getExpandedRegion());
}
OpenPOWER on IntegriCloud