diff options
author | Florian Hahn <florian.hahn@arm.com> | 2018-05-24 21:33:17 +0000 |
---|---|---|
committer | Florian Hahn <florian.hahn@arm.com> | 2018-05-24 21:33:17 +0000 |
commit | f48234e221a729e98695300a795a6cdbd6a3e6e2 (patch) | |
tree | 901e9a4fbf2c590af7ca49f49659e8e7595c1704 | |
parent | f501bf3e3923e96a6c9d849b9f35a15a3999b7a4 (diff) |
[LegacyPM] Use MapVector for OnTheFlyPassManagers.
Currently the iteration order of OnTheFlyManagers is not deterministic
between executions, which means some of test/Other/opt-*-pipeline.ll
tests fail non-deterministically if an additional on-the-fly manager is
added, as in D45330.
By using MapVector, we always iterate in the insertion order. As we are
not removing elements, there shouldn't be a performance hit, except that
we store an additional vector with the keys.
Reviewers: efriedma, chandlerc, pcc, jhenderson
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D47317
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333231 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/IR/LegacyPassManager.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/IR/LegacyPassManager.cpp b/lib/IR/LegacyPassManager.cpp index 6f3da0245c1..b04787cb30e 100644 --- a/lib/IR/LegacyPassManager.cpp +++ b/lib/IR/LegacyPassManager.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/IR/LegacyPassManager.h" +#include "llvm/ADT/MapVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/IRPrintingPasses.h" @@ -29,7 +30,6 @@ #include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> -#include <map> #include <unordered_set> using namespace llvm; using namespace llvm::legacy; @@ -414,8 +414,8 @@ public: for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { ModulePass *MP = getContainedPass(Index); MP->dumpPassStructure(Offset + 1); - std::map<Pass *, FunctionPassManagerImpl *>::const_iterator I = - OnTheFlyManagers.find(MP); + MapVector<Pass *, FunctionPassManagerImpl *>::const_iterator I = + OnTheFlyManagers.find(MP); if (I != OnTheFlyManagers.end()) I->second->dumpPassStructure(Offset + 2); dumpLastUses(MP, Offset+1); @@ -434,7 +434,7 @@ public: private: /// Collection of on the fly FPPassManagers. These managers manage /// function passes that are required by module passes. - std::map<Pass *, FunctionPassManagerImpl *> OnTheFlyManagers; + MapVector<Pass *, FunctionPassManagerImpl *> OnTheFlyManagers; }; char MPPassManager::ID = 0; |