@@ -332,9 +332,11 @@ class DataFlowSolver {
332
332
// / does not exist.
333
333
template <typename StateT, typename AnchorT>
334
334
const StateT *lookupState (AnchorT anchor) const {
335
- auto it =
336
- analysisStates.find ({LatticeAnchor (anchor), TypeID::get<StateT>()});
337
- if (it == analysisStates.end ())
335
+ const auto &mapIt = analysisStates.find (LatticeAnchor (anchor));
336
+ if (mapIt == analysisStates.end ())
337
+ return nullptr ;
338
+ auto it = mapIt->second .find (TypeID::get<StateT>());
339
+ if (it == mapIt->second .end ())
338
340
return nullptr ;
339
341
return static_cast <const StateT *>(it->second .get ());
340
342
}
@@ -343,11 +345,7 @@ class DataFlowSolver {
343
345
template <typename AnchorT>
344
346
void eraseState (AnchorT anchor) {
345
347
LatticeAnchor la (anchor);
346
-
347
- for (auto it = analysisStates.begin (); it != analysisStates.end (); ++it) {
348
- if (it->first .first == la)
349
- analysisStates.erase (it);
350
- }
348
+ analysisStates.erase (LatticeAnchor (anchor));
351
349
}
352
350
353
351
// Erase all analysis states
@@ -426,7 +424,8 @@ class DataFlowSolver {
426
424
427
425
// / A type-erased map of lattice anchors to associated analysis states for
428
426
// / first-class lattice anchors.
429
- DenseMap<std::pair<LatticeAnchor, TypeID>, std::unique_ptr<AnalysisState>>
427
+ DenseMap<LatticeAnchor, DenseMap<TypeID, std::unique_ptr<AnalysisState>>,
428
+ DenseMapInfo<LatticeAnchor::ParentTy>>
430
429
analysisStates;
431
430
432
431
// / Allow the base child analysis class to access the internals of the solver.
@@ -643,7 +642,7 @@ AnalysisT *DataFlowSolver::load(Args &&...args) {
643
642
template <typename StateT, typename AnchorT>
644
643
StateT *DataFlowSolver::getOrCreateState (AnchorT anchor) {
645
644
std::unique_ptr<AnalysisState> &state =
646
- analysisStates[{ LatticeAnchor (anchor), TypeID::get<StateT>()} ];
645
+ analysisStates[LatticeAnchor (anchor)][ TypeID::get<StateT>()];
647
646
if (!state) {
648
647
state = std::unique_ptr<StateT>(new StateT (anchor));
649
648
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
@@ -689,10 +688,6 @@ struct DenseMapInfo<mlir::ProgramPoint> {
689
688
}
690
689
};
691
690
692
- template <>
693
- struct DenseMapInfo <mlir::LatticeAnchor>
694
- : public DenseMapInfo<mlir::LatticeAnchor::ParentTy> {};
695
-
696
691
// Allow llvm::cast style functions.
697
692
template <typename To>
698
693
struct CastInfo <To, mlir::LatticeAnchor>
0 commit comments