[LLVMdev] [PATCH 5/5] Don't add the same analysis implementation pair twice.

jfonseca at vmware.com
2011-03-15T23:15:55Z

From: José Fonseca <jfonseca at vmware.com>

Prevent infinite growth of the list.
---
 include/llvm/PassAnalysisSupport.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/llvm/PassAnalysisSupport.h
b/include/llvm/PassAnalysisSupport.h
index a3342d5..fede121 100644
--- a/include/llvm/PassAnalysisSupport.h
+++ b/include/llvm/PassAnalysisSupport.h
@@ -142,6 +142,8 @@ public:
   Pass *findImplPass(Pass *P, AnalysisID PI, Function &F);

   void addAnalysisImplsPair(AnalysisID PI, Pass *P) {
+    if (findImplPass(PI) == P)
+      return;
     std::pair<AnalysisID, Pass*> pir = std::make_pair(PI,P);
     AnalysisImpls.push_back(pir);
   }
--
1.7.4.1