[Attributor][Fix] Avoid leaking memory after D68765
authorJohannes Doerfert <johannes@jdoerfert.de>
Tue, 31 Dec 2019 16:55:07 +0000 (10:55 -0600)
committerJohannes Doerfert <johannes@jdoerfert.de>
Tue, 31 Dec 2019 16:55:07 +0000 (10:55 -0600)
llvm/include/llvm/Transforms/IPO/Attributor.h

index 3f4087b..1aafab0 100644 (file)
@@ -694,7 +694,11 @@ struct Attributor {
       : InfoCache(InfoCache), DepRecomputeInterval(DepRecomputeInterval),
         Whitelist(Whitelist) {}
 
-  ~Attributor() { DeleteContainerPointers(AllAbstractAttributes); }
+  ~Attributor() {
+    DeleteContainerPointers(AllAbstractAttributes);
+    for (auto &It : ArgumentReplacementMap)
+      DeleteContainerPointers(It.second);
+  }
 
   /// Run the analyses until a fixpoint is reached or enforced (timeout).
   ///