diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp --- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp +++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp @@ -1912,8 +1912,10 @@ Operands.push_back(RISCVOperand::createToken(Name, NameLoc, isRV64())); // If there are no more operands, then finish - if (getLexer().is(AsmToken::EndOfStatement)) + if (getLexer().is(AsmToken::EndOfStatement)) { + getParser().Lex(); // Consume the EndOfStatement. return false; + } // Parse first operand if (parseOperand(Operands, Name)) diff --git a/llvm/test/CodeGen/RISCV/large-stack.ll b/llvm/test/CodeGen/RISCV/large-stack.ll --- a/llvm/test/CodeGen/RISCV/large-stack.ll +++ b/llvm/test/CodeGen/RISCV/large-stack.ll @@ -64,12 +64,10 @@ ; RV32I-FPELIM-NEXT: add a1, a2, a1 ; RV32I-FPELIM-NEXT: #APP ; RV32I-FPELIM-NEXT: nop -; RV32I-FPELIM-EMPTY: ; RV32I-FPELIM-NEXT: #NO_APP ; RV32I-FPELIM-NEXT: sw a0, 0(a1) ; RV32I-FPELIM-NEXT: #APP ; RV32I-FPELIM-NEXT: nop -; RV32I-FPELIM-EMPTY: ; RV32I-FPELIM-NEXT: #NO_APP ; RV32I-FPELIM-NEXT: lui a0, 97 ; RV32I-FPELIM-NEXT: addi a0, a0, 672 @@ -104,12 +102,10 @@ ; RV32I-WITHFP-NEXT: add a1, a2, a1 ; RV32I-WITHFP-NEXT: #APP ; RV32I-WITHFP-NEXT: nop -; RV32I-WITHFP-EMPTY: ; RV32I-WITHFP-NEXT: #NO_APP ; RV32I-WITHFP-NEXT: sw a0, 0(a1) ; RV32I-WITHFP-NEXT: #APP ; RV32I-WITHFP-NEXT: nop -; RV32I-WITHFP-EMPTY: ; RV32I-WITHFP-NEXT: #NO_APP ; RV32I-WITHFP-NEXT: lui a0, 97 ; RV32I-WITHFP-NEXT: addi a0, a0, 688