[llvm] c229250 - [mips] Use isInt<> call instead of explicit range checking. NFC

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 22:30:11 PST 2019


Author: Simon Atanasyan
Date: 2019-11-14T09:29:31+03:00
New Revision: c2292502d896ee8d9a5d034ffede8f43c5e03b33

URL: https://github.com/llvm/llvm-project/commit/c2292502d896ee8d9a5d034ffede8f43c5e03b33
DIFF: https://github.com/llvm/llvm-project/commit/c2292502d896ee8d9a5d034ffede8f43c5e03b33.diff

LOG: [mips] Use isInt<> call instead of explicit range checking. NFC

Added: 
    

Modified: 
    llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index c69b5deed825..94004d3df04e 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -2081,8 +2081,7 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
           (OpInfo.OperandType == MCOI::OPERAND_UNKNOWN)) {
         MCOperand &Op = Inst.getOperand(i);
         if (Op.isImm()) {
-          int64_t MemOffset = Op.getImm();
-          if (MemOffset < -32768 || MemOffset > 32767) {
+          if (!isInt<16>(Op.getImm())) {
             // Offset can't exceed 16bit value.
             expandMemInst(Inst, IDLoc, Out, STI, MCID.mayLoad());
             return getParser().hasPendingError();


        


More information about the llvm-commits mailing list