[llvm] r333231 - [LegacyPM] Use MapVector for OnTheFlyPassManagers.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu May 24 14:33:17 PDT 2018
Author: fhahn
Date: Thu May 24 14:33:17 2018
New Revision: 333231
URL: http://llvm.org/viewvc/llvm-project?rev=333231&view=rev
Log:
[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
Modified:
llvm/trunk/lib/IR/LegacyPassManager.cpp
Modified: llvm/trunk/lib/IR/LegacyPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LegacyPassManager.cpp?rev=333231&r1=333230&r2=333231&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LegacyPassManager.cpp (original)
+++ llvm/trunk/lib/IR/LegacyPassManager.cpp Thu May 24 14:33:17 2018
@@ -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;
More information about the llvm-commits
mailing list