[llvm] r354356 - X86AsmParser AVX-512: Return error instead of hitting assert
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 19 09:13:40 PST 2019
Author: ctopper
Date: Tue Feb 19 09:13:40 2019
New Revision: 354356
URL: http://llvm.org/viewvc/llvm-project?rev=354356&view=rev
Log:
X86AsmParser AVX-512: Return error instead of hitting assert
When parsing a sequence of tokens beginning with {, it will hit an assert and crash if the token afterwards is not an identifier. Instead of this, return a more verbose error as seen elsewhere in the function.
Patch by Brandon Jones (BrandonTJones)
Differential Revision: https://reviews.llvm.org/D57375
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/test/MC/X86/avx512-err.s
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=354356&r1=354355&r2=354356&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Feb 19 09:13:40 2019
@@ -1654,6 +1654,8 @@ X86AsmParser::ParseRoundingModeOp(SMLoc
const AsmToken &Tok = Parser.getTok();
// Eat "{" and mark the current place.
const SMLoc consumedToken = consumeToken();
+ if (Tok.isNot(AsmToken::Identifier))
+ return ErrorOperand(Tok.getLoc(), "Expected an identifier after {");
if (Tok.getIdentifier().startswith("r")){
int rndMode = StringSwitch<int>(Tok.getIdentifier())
.Case("rn", X86::STATIC_ROUNDING::TO_NEAREST_INT)
Modified: llvm/trunk/test/MC/X86/avx512-err.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/avx512-err.s?rev=354356&r1=354355&r2=354356&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/avx512-err.s (original)
+++ llvm/trunk/test/MC/X86/avx512-err.s Tue Feb 19 09:13:40 2019
@@ -11,3 +11,6 @@ vfmsub213ps %zmm8, %zmm8, %zmm8 {rn-sae}
// ERR: invalid operand for instruction
cvtsd2sil {rn-sae}, %xmm1, %eax
+
+// ERR: Expected an identifier after {
+cvtsd2sil {{sae}, %xmm1, %eax
More information about the llvm-commits
mailing list