[RISCV] Use ~0ULL instead of ~0U when checking for invalid ErrorInfo.
authorCraig Topper <craig.topper@sifive.com>
Fri, 27 Aug 2021 19:30:31 +0000 (12:30 -0700)
committerCraig Topper <craig.topper@sifive.com>
Fri, 27 Aug 2021 19:30:33 +0000 (12:30 -0700)
ErrorInfo is a uint64_t and is initialized to all 1s.

Not sure how to test this. Noticed while working on .insn support.

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

index b2683d5..c3ccec1 100644 (file)
@@ -1002,7 +1002,7 @@ bool RISCVAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
   }
   case Match_InvalidOperand: {
     SMLoc ErrorLoc = IDLoc;
-    if (ErrorInfo != ~0U) {
+    if (ErrorInfo != ~0ULL) {
       if (ErrorInfo >= Operands.size())
         return Error(ErrorLoc, "too few operands for instruction");
 
@@ -1019,7 +1019,7 @@ bool RISCVAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
   // corresponding operand is missing.
   if (Result > FIRST_TARGET_MATCH_RESULT_TY) {
     SMLoc ErrorLoc = IDLoc;
-    if (ErrorInfo != ~0U && ErrorInfo >= Operands.size())
+    if (ErrorInfo != ~0ULL && ErrorInfo >= Operands.size())
       return Error(ErrorLoc, "too few operands for instruction");
   }