diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp --- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp @@ -447,20 +447,19 @@ }; template -struct BooleanStateWithPtrSetVector : public BooleanState { - - bool contains(Ty *Elem) const { return Set.contains(Elem); } - bool insert(Ty *Elem) { +struct BooleanStateWithSetVector : public BooleanState { + bool contains(const Ty &Elem) const { return Set.contains(Elem); } + bool insert(const Ty &Elem) { if (InsertInvalidates) BooleanState::indicatePessimisticFixpoint(); return Set.insert(Elem); } - Ty *operator[](int Idx) const { return Set[Idx]; } - bool operator==(const BooleanStateWithPtrSetVector &RHS) const { + const Ty &operator[](int Idx) const { return Set[Idx]; } + bool operator==(const BooleanStateWithSetVector &RHS) const { return BooleanState::operator==(RHS) && Set == RHS.Set; } - bool operator!=(const BooleanStateWithPtrSetVector &RHS) const { + bool operator!=(const BooleanStateWithSetVector &RHS) const { return !(*this == RHS); } @@ -468,8 +467,7 @@ size_t size() const { return Set.size(); } /// "Clamp" this state with \p RHS. - BooleanStateWithPtrSetVector & - operator^=(const BooleanStateWithPtrSetVector &RHS) { + BooleanStateWithSetVector &operator^=(const BooleanStateWithSetVector &RHS) { BooleanState::operator^=(RHS); Set.insert(RHS.Set.begin(), RHS.Set.end()); return *this; @@ -477,7 +475,7 @@ private: /// A set to keep track of elements. - SetVector Set; + SetVector Set; public: typename decltype(Set)::iterator begin() { return Set.begin(); } @@ -486,6 +484,10 @@ typename decltype(Set)::const_iterator end() const { return Set.end(); } }; +template +using BooleanStateWithPtrSetVector = + BooleanStateWithSetVector; + struct KernelInfoState : AbstractState { /// Flag to track if we reached a fixpoint. bool IsAtFixpoint = false;