@@ -91,10 +91,6 @@ class ValueEvolution {
9191 APInt GenPoly;
9292 StringRef ErrStr;
9393
94- // A set of instructions visited by ValueEvolution. Anything that's not in the
95- // use-def chain of the PHIs' evolution will be reported as unvisited.
96- SmallPtrSet<const Instruction *, 16 > Visited;
97-
9894 // Compute the KnownBits of a BinaryOperator.
9995 KnownBits computeBinOp (const BinaryOperator *I);
10096
@@ -116,23 +112,23 @@ class ValueEvolution {
116112 // the final iteration. Returns true on success and false on error.
117113 bool computeEvolutions (ArrayRef<PhiStepPair> PhiEvolutions);
118114
119- // Query the Visited set.
120- bool isVisited (const Instruction *I) const { return Visited.contains (I); }
121-
122115 // In case ValueEvolution encounters an error, this is meant to be used for a
123116 // precise error message.
124117 StringRef getError () const { return ErrStr; }
125118
119+ // A set of instructions visited by ValueEvolution. Anything that's not in the
120+ // use-def chain of the PHIs' evolution will not be visited.
121+ SmallPtrSet<const Instruction *, 16 > Visited;
122+
126123 // The computed KnownBits for each PHI node, which is populated after
127124 // computeEvolutions is called.
128125 KnownPhiMap KnownPhis;
129126};
130127
131128ValueEvolution::ValueEvolution (unsigned TripCount, bool ByteOrderSwapped,
132129 ArrayRef<const Instruction *> InitVisited)
133- : TripCount(TripCount), ByteOrderSwapped(ByteOrderSwapped) {
134- Visited.insert_range (InitVisited);
135- }
130+ : TripCount(TripCount), ByteOrderSwapped(ByteOrderSwapped),
131+ Visited(InitVisited.begin(), InitVisited.end()) {}
136132
137133KnownBits ValueEvolution::computeBinOp (const BinaryOperator *I) {
138134 KnownBits KnownL (compute (I->getOperand (0 )));
@@ -665,7 +661,7 @@ HashRecognize::recognizeCRC() const {
665661 // Any unvisited instructions from the KnownBits propagation can complicate
666662 // the optimization, which would just replace the entire loop with the
667663 // table-lookup version of the hash algorithm.
668- if (any_of (* Latch, [VE]( const Instruction &I) { return ! VE.isVisited (&I); } ))
664+ if (std::distance ( Latch-> begin (), Latch-> end ()) != VE.Visited . size ( ))
669665 return " Found stray unvisited instructions" ;
670666
671667 unsigned N = std::min (TC, ResultBits.getBitWidth ());
0 commit comments