diff options
author | Sergei Barannikov <barannikov88@gmail.com> | 2025-08-14 06:36:24 +0300 |
---|---|---|
committer | Sergei Barannikov <barannikov88@gmail.com> | 2025-08-14 06:36:24 +0300 |
commit | a73403ba8ab86a264231ab8aff600fc890eaf77d (patch) | |
tree | c3ffee50623462c7cde0d0fafffe230bee524fcd /llvm/utils/TableGen/DecoderEmitter.cpp | |
parent | 6abb6264ea5577071dc5ac9e289dd1660553ad39 (diff) | |
download | llvm-a73403ba8ab86a264231ab8aff600fc890eaf77d.zip llvm-a73403ba8ab86a264231ab8aff600fc890eaf77d.tar.gz llvm-a73403ba8ab86a264231ab8aff600fc890eaf77d.tar.bz2 |
[TableGen] Use `empty()` instead of `size() == 0` (NFC)
Diffstat (limited to 'llvm/utils/TableGen/DecoderEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/DecoderEmitter.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp index 997f9a5..b4b9cb0 100644 --- a/llvm/utils/TableGen/DecoderEmitter.cpp +++ b/llvm/utils/TableGen/DecoderEmitter.cpp @@ -1553,18 +1553,17 @@ void FilterChooser::reportRegion(bitAttr_t RA, unsigned StartBit, bool FilterChooser::filterProcessor(bool AllowMixed, bool Greedy) { Filters.clear(); BestIndex = -1; - unsigned numInstructions = Opcodes.size(); - assert(numInstructions && "Filter created with no instructions"); + assert(!Opcodes.empty() && "Filter created with no instructions"); // No further filtering is necessary. - if (numInstructions == 1) + if (Opcodes.size() == 1) return true; // Heuristics. See also doFilter()'s "Heuristics" comment when num of // instructions is 3. if (AllowMixed && !Greedy) { - assert(numInstructions == 3); + assert(Opcodes.size() == 3); for (const auto &Opcode : Opcodes) { insn_t Insn = insnWithID(Opcode.EncodingID); @@ -1771,8 +1770,7 @@ bool FilterChooser::filterProcessor(bool AllowMixed, bool Greedy) { // the instructions. A conflict of instructions may occur, in which case we // dump the conflict set to the standard error. void FilterChooser::doFilter() { - unsigned Num = Opcodes.size(); - assert(Num && "FilterChooser created with no instructions"); + assert(!Opcodes.empty() && "FilterChooser created with no instructions"); // Try regions of consecutive known bit values first. if (filterProcessor(false)) @@ -1786,7 +1784,7 @@ void FilterChooser::doFilter() { // no single instruction for the maximum ATTR_MIXED region Inst{14-4} has a // well-known encoding pattern. In such case, we backtrack and scan for the // the very first consecutive ATTR_ALL_SET region and assign a filter to it. - if (Num == 3 && filterProcessor(true, false)) + if (Opcodes.size() == 3 && filterProcessor(true, false)) return; // If we come to here, the instruction decoding has failed. |