Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,19 @@ struct MachineValueTypeSet {
private:
unsigned find_from_pos(unsigned P) const {
unsigned SkipWords = P / WordWidth;
unsigned SkipBits = P % WordWidth;
unsigned Count = SkipWords * WordWidth;

// If P is in the middle of a word, process it manually here, because
// the trailing bits need to be masked off to use findFirstSet.
if (SkipBits != 0) {
WordType W = Set->Words[SkipWords];
W &= maskLeadingOnes<WordType>(WordWidth - SkipBits);
if (W != 0)
return Count + llvm::countr_zero(W);
Count += WordWidth;
SkipWords++;
}

for (unsigned i = SkipWords; i != NumWords; ++i) {
WordType W = Set->Words[i];

// If P is in the middle of a word, process it manually here, because
// the trailing bits need to be masked off to use countr_zero.
if (i == SkipWords) {
unsigned SkipBits = P % WordWidth;
W &= maskTrailingZeros<WordType>(SkipBits);
}

if (W != 0)
return Count + llvm::countr_zero(W);
Count += WordWidth;
return i * WordWidth + llvm::countr_zero(W);
}
return Capacity;
}
Expand Down