diff options
| author | Fangrui Song <i@maskray.me> | 2022-09-18 23:25:58 -0700 |
|---|---|---|
| committer | Fangrui Song <i@maskray.me> | 2022-09-18 23:25:58 -0700 |
| commit | b5137ffd8367404ff35631b170bc9a29e9ff5c04 (patch) | |
| tree | e3704f30869ff303a46a4cfde17cdeae11fd72d6 /llvm/utils/TableGen/CodeEmitterGen.cpp | |
| parent | a42053a1fa81c3041ba4140c476a766ef71010b2 (diff) | |
[TableGen] Optimize APInt |= with setBit. NFC
Diffstat (limited to 'llvm/utils/TableGen/CodeEmitterGen.cpp')
| -rw-r--r-- | llvm/utils/TableGen/CodeEmitterGen.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/CodeEmitterGen.cpp b/llvm/utils/TableGen/CodeEmitterGen.cpp index 1d00c3cfd069..004f94f18b76 100644 --- a/llvm/utils/TableGen/CodeEmitterGen.cpp +++ b/llvm/utils/TableGen/CodeEmitterGen.cpp @@ -370,8 +370,8 @@ void CodeEmitterGen::emitInstructionBaseValues( // Start by filling in fixed values. APInt Value(BitWidth, 0); for (unsigned i = 0, e = BI->getNumBits(); i != e; ++i) { - if (BitInit *B = dyn_cast<BitInit>(BI->getBit(e - i - 1))) - Value |= APInt(BitWidth, (uint64_t)B->getValue()) << (e - i - 1); + if (auto *B = dyn_cast<BitInit>(BI->getBit(i)); B && B->getValue()) + Value.setBit(i); } o << " "; emitInstBits(o, Value); |
