[ORC] Clear SymbolToDefinitionMap when materializing a MaterializationUnit.
authorLang Hames <lhames@gmail.com>
Sat, 29 Sep 2018 23:49:56 +0000 (23:49 +0000)
committerLang Hames <lhames@gmail.com>
Sat, 29 Sep 2018 23:49:56 +0000 (23:49 +0000)
The map is inaccessible at this point, so we may as well reclaim the memory
early.

llvm-svn: 343395

llvm/lib/ExecutionEngine/Orc/Layer.cpp

index 38afead..f74f1c8 100644 (file)
@@ -76,6 +76,11 @@ BasicIRLayerMaterializationUnit::BasicIRLayerMaterializationUnit(
 void BasicIRLayerMaterializationUnit::materialize(
     MaterializationResponsibility R) {
 
+  // Throw away the SymbolToDefinition map: it's not usable after we hand
+  // off the module.
+  SymbolToDefinition.clear();
+
+  // If cloneToNewContextOnEmit is set, clone the module now.
   if (L.getCloneToNewContextOnEmit())
     TSM = cloneToNewContext(TSM);