summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/PassManager.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2016-02-23 00:05:00 +0000
committerChandler Carruth <chandlerc@gmail.com>2016-02-23 00:05:00 +0000
commit77b6e47f74279c4d42b00002450bd42743045f3b (patch)
treea60b7e2e8b964c41905f3c05b5911bf15bf286a7 /llvm/lib/IR/PassManager.cpp
parent6e3d8e7f0685203d0e578a9a0f88e6c8324e76dd (diff)
downloadbcm5719-llvm-77b6e47f74279c4d42b00002450bd42743045f3b.tar.gz
bcm5719-llvm-77b6e47f74279c4d42b00002450bd42743045f3b.zip
[PM] Improve the API and comments around the analysis manager proxies.
These are really handles that ensure the analyses get cleared at appropriate places, and as such copying doesn't really make sense. Instead, they should look more like unique ownership objects. Make that the case. Relatedly, if you create a temporary of one and move out of it its destructor shouldn't actually clear anything. I don't think there is any code that can trigger this currently, but it seems like a more robust implementation. If folks want, I can add a unittest that forces this to be exercised, but that seems somewhat pointless -- whether a temporary is ever created in the innards of AnalysisManager is not really something we should be adding a reliance on, but I didn't want to leave a timebomb in the code here. If anyone has a cleaner way to represent this, I'm all ears, but I wanted to assure myself that this wasn't in fact responsible for another bug I'm chasing down (it wasn't) and figured I'd commit that. llvm-svn: 261594
Diffstat (limited to 'llvm/lib/IR/PassManager.cpp')
-rw-r--r--llvm/lib/IR/PassManager.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/PassManager.cpp b/llvm/lib/IR/PassManager.cpp
index a5f407c00e8..f55db9c1e64 100644
--- a/llvm/lib/IR/PassManager.cpp
+++ b/llvm/lib/IR/PassManager.cpp
@@ -22,6 +22,10 @@ FunctionAnalysisManagerModuleProxy::run(Module &M) {
}
FunctionAnalysisManagerModuleProxy::Result::~Result() {
+ // FAM is cleared in a moved from state where there is nothing to do.
+ if (!FAM)
+ return;
+
// Clear out the analysis manager if we're being destroyed -- it means we
// didn't even see an invalidate call when we got invalidated.
FAM->clear();
OpenPOWER on IntegriCloud