summaryrefslogtreecommitdiff
path: root/lib/IR/LLVMContextImpl.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 10:51:19 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 10:51:19 +0000
commiteb11fae6d08f479c0799db45860a98af528fa6e7 (patch)
tree44d492a50c8c1a7eb8e2d17ea3360ec4d066f042 /lib/IR/LLVMContextImpl.cpp
parentb8a2042aa938069e862750553db0e4d82d25822c (diff)
Notes
Diffstat (limited to 'lib/IR/LLVMContextImpl.cpp')
-rw-r--r--lib/IR/LLVMContextImpl.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/IR/LLVMContextImpl.cpp b/lib/IR/LLVMContextImpl.cpp
index 4b44a6b69cad..3c34ca55c224 100644
--- a/lib/IR/LLVMContextImpl.cpp
+++ b/lib/IR/LLVMContextImpl.cpp
@@ -48,6 +48,14 @@ LLVMContextImpl::~LLVMContextImpl() {
while (!OwnedModules.empty())
delete *OwnedModules.begin();
+#ifndef NDEBUG
+ // Check for metadata references from leaked Instructions.
+ for (auto &Pair : InstructionMetadata)
+ Pair.first->dump();
+ assert(InstructionMetadata.empty() &&
+ "Instructions with metadata have been leaked");
+#endif
+
// Drop references for MDNodes. Do this before Values get deleted to avoid
// unnecessary RAUW when nodes are still unresolved.
for (auto *I : DistinctMDNodes)
@@ -155,7 +163,7 @@ void Module::dropTriviallyDeadConstantArrays() {
namespace llvm {
-/// \brief Make MDOperand transparent for hashing.
+/// Make MDOperand transparent for hashing.
///
/// This overload of an implementation detail of the hashing library makes
/// MDOperand hash to the same value as a \a Metadata pointer.
@@ -222,8 +230,8 @@ void LLVMContextImpl::getSyncScopeNames(
/// Singleton instance of the OptBisect class.
///
-/// This singleton is accessed via the LLVMContext::getOptBisect() function. It
-/// provides a mechanism to disable passes and individual optimizations at
+/// This singleton is accessed via the LLVMContext::getOptPassGate() function.
+/// It provides a mechanism to disable passes and individual optimizations at
/// compile time based on a command line option (-opt-bisect-limit) in order to
/// perform a bisecting search for optimization-related problems.
///
@@ -233,6 +241,12 @@ void LLVMContextImpl::getSyncScopeNames(
/// enabled in order to enable a consistent bisect count.
static ManagedStatic<OptBisect> OptBisector;
-OptBisect &LLVMContextImpl::getOptBisect() {
- return *OptBisector;
+OptPassGate &LLVMContextImpl::getOptPassGate() const {
+ if (!OPG)
+ OPG = &(*OptBisector);
+ return *OPG;
+}
+
+void LLVMContextImpl::setOptPassGate(OptPassGate& OPG) {
+ this->OPG = &OPG;
}