Skip to content

Commit a73403b

Browse files
committed
[TableGen] Use empty() instead of size() == 0 (NFC)
1 parent 6abb626 commit a73403b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

llvm/utils/TableGen/DecoderEmitter.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,18 +1553,17 @@ void FilterChooser::reportRegion(bitAttr_t RA, unsigned StartBit,
15531553
bool FilterChooser::filterProcessor(bool AllowMixed, bool Greedy) {
15541554
Filters.clear();
15551555
BestIndex = -1;
1556-
unsigned numInstructions = Opcodes.size();
15571556

1558-
assert(numInstructions && "Filter created with no instructions");
1557+
assert(!Opcodes.empty() && "Filter created with no instructions");
15591558

15601559
// No further filtering is necessary.
1561-
if (numInstructions == 1)
1560+
if (Opcodes.size() == 1)
15621561
return true;
15631562

15641563
// Heuristics. See also doFilter()'s "Heuristics" comment when num of
15651564
// instructions is 3.
15661565
if (AllowMixed && !Greedy) {
1567-
assert(numInstructions == 3);
1566+
assert(Opcodes.size() == 3);
15681567

15691568
for (const auto &Opcode : Opcodes) {
15701569
insn_t Insn = insnWithID(Opcode.EncodingID);
@@ -1771,8 +1770,7 @@ bool FilterChooser::filterProcessor(bool AllowMixed, bool Greedy) {
17711770
// the instructions. A conflict of instructions may occur, in which case we
17721771
// dump the conflict set to the standard error.
17731772
void FilterChooser::doFilter() {
1774-
unsigned Num = Opcodes.size();
1775-
assert(Num && "FilterChooser created with no instructions");
1773+
assert(!Opcodes.empty() && "FilterChooser created with no instructions");
17761774

17771775
// Try regions of consecutive known bit values first.
17781776
if (filterProcessor(false))
@@ -1786,7 +1784,7 @@ void FilterChooser::doFilter() {
17861784
// no single instruction for the maximum ATTR_MIXED region Inst{14-4} has a
17871785
// well-known encoding pattern. In such case, we backtrack and scan for the
17881786
// the very first consecutive ATTR_ALL_SET region and assign a filter to it.
1789-
if (Num == 3 && filterProcessor(true, false))
1787+
if (Opcodes.size() == 3 && filterProcessor(true, false))
17901788
return;
17911789

17921790
// If we come to here, the instruction decoding has failed.

0 commit comments

Comments
 (0)