@@ -91,10 +91,6 @@ class ValueEvolution {
91
91
APInt GenPoly;
92
92
StringRef ErrStr;
93
93
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
-
98
94
// Compute the KnownBits of a BinaryOperator.
99
95
KnownBits computeBinOp (const BinaryOperator *I);
100
96
@@ -116,23 +112,23 @@ class ValueEvolution {
116
112
// the final iteration. Returns true on success and false on error.
117
113
bool computeEvolutions (ArrayRef<PhiStepPair> PhiEvolutions);
118
114
119
- // Query the Visited set.
120
- bool isVisited (const Instruction *I) const { return Visited.contains (I); }
121
-
122
115
// In case ValueEvolution encounters an error, this is meant to be used for a
123
116
// precise error message.
124
117
StringRef getError () const { return ErrStr; }
125
118
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
+
126
123
// The computed KnownBits for each PHI node, which is populated after
127
124
// computeEvolutions is called.
128
125
KnownPhiMap KnownPhis;
129
126
};
130
127
131
128
ValueEvolution::ValueEvolution (unsigned TripCount, bool ByteOrderSwapped,
132
129
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()) {}
136
132
137
133
KnownBits ValueEvolution::computeBinOp (const BinaryOperator *I) {
138
134
KnownBits KnownL (compute (I->getOperand (0 )));
@@ -665,7 +661,7 @@ HashRecognize::recognizeCRC() const {
665
661
// Any unvisited instructions from the KnownBits propagation can complicate
666
662
// the optimization, which would just replace the entire loop with the
667
663
// 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 ( ))
669
665
return " Found stray unvisited instructions" ;
670
666
671
667
unsigned N = std::min (TC, ResultBits.getBitWidth ());
0 commit comments