File tree Expand file tree Collapse file tree 1 file changed +9
-15
lines changed
llvm/utils/TableGen/Common Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -138,25 +138,19 @@ struct MachineValueTypeSet {
138138 private:
139139 unsigned find_from_pos (unsigned P) const {
140140 unsigned SkipWords = P / WordWidth;
141- unsigned SkipBits = P % WordWidth;
142- unsigned Count = SkipWords * WordWidth;
143-
144- // If P is in the middle of a word, process it manually here, because
145- // the trailing bits need to be masked off to use findFirstSet.
146- if (SkipBits != 0 ) {
147- WordType W = Set->Words [SkipWords];
148- W &= maskLeadingOnes<WordType>(WordWidth - SkipBits);
149- if (W != 0 )
150- return Count + llvm::countr_zero (W);
151- Count += WordWidth;
152- SkipWords++;
153- }
154141
155142 for (unsigned i = SkipWords; i != NumWords; ++i) {
156143 WordType W = Set->Words [i];
144+
145+ // If P is in the middle of a word, process it manually here, because
146+ // the trailing bits need to be masked off to use countr_zero.
147+ if (i == SkipWords) {
148+ unsigned SkipBits = P % WordWidth;
149+ W &= maskTrailingZeros<WordType>(SkipBits);
150+ }
151+
157152 if (W != 0 )
158- return Count + llvm::countr_zero (W);
159- Count += WordWidth;
153+ return i * WordWidth + llvm::countr_zero (W);
160154 }
161155 return Capacity;
162156 }
You can’t perform that action at this time.
0 commit comments