Index: lib/CodeGen/CodeGenPrepare.cpp =================================================================== --- lib/CodeGen/CodeGenPrepare.cpp +++ lib/CodeGen/CodeGenPrepare.cpp @@ -2650,7 +2650,7 @@ const SimplifyQuery &SQ; // Tracks newly created Phi nodes. We use a SetVector to get deterministic // order when iterating over the set in MatchPhiSet. - SmallSetVector AllPhiNodes; + SmallPtrSet AllPhiNodes; // Tracks newly created Select nodes. SmallPtrSet AllSelectNodes; @@ -2682,7 +2682,7 @@ Put(PI, V); PI->replaceAllUsesWith(V); if (auto *PHI = dyn_cast(PI)) - AllPhiNodes.remove(PHI); + AllPhiNodes.erase(PHI); if (auto *Select = dyn_cast(PI)) AllSelectNodes.erase(Select); PI->eraseFromParent(); @@ -2705,11 +2705,11 @@ assert(Get(To) == To && "Replacement PHI node is already replaced."); Put(From, To); From->replaceAllUsesWith(To); - AllPhiNodes.remove(From); + AllPhiNodes.erase(From); From->eraseFromParent(); } - SmallSetVector& newPhiNodes() { return AllPhiNodes; } + SmallPtrSet& newPhiNodes() { return AllPhiNodes; } void insertNewPhi(PHINode *PN) { AllPhiNodes.insert(PN); } @@ -2954,7 +2954,7 @@ /// Matcher tracks the matched Phi nodes. bool MatchPhiNode(PHINode *PHI, PHINode *Candidate, SmallSetVector &Matcher, - SmallSetVector &PhiNodesToMatch) { + SmallPtrSet &PhiNodesToMatch) { SmallVector WorkList; Matcher.insert({ PHI, Candidate }); WorkList.push_back({ PHI, Candidate }); @@ -3007,7 +3007,7 @@ // in a deterministic order below. SmallSetVector Matched; SmallPtrSet WillNotMatch; - SmallSetVector &PhiNodesToMatch = ST.newPhiNodes(); + SmallPtrSet &PhiNodesToMatch = ST.newPhiNodes(); while (PhiNodesToMatch.size()) { PHINode *PHI = *PhiNodesToMatch.begin(); @@ -3042,7 +3042,7 @@ // Just remove all seen values in matcher. They will not match anything. PhiNotMatchedCount += WillNotMatch.size(); for (auto *P : WillNotMatch) - PhiNodesToMatch.remove(P); + PhiNodesToMatch.erase(P); } return true; }