[llvm] [X86AsmParser] IntelExpression: End of Statement should check for valid end state (PR #95677)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 09:33:24 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: None (v01dXYZ)

<details>
<summary>Changes</summary>

The following commit bfb7099eeb9b6f62510b1db0cb93a8c3cfa68236 added a special case for End of Statement that doesn't check if the state machine is rightfully in a state where ending is valid.

This PR suggest to revert this change to make `EndOfStatement` processed as any other tokens that are not consumable by the state machine.

Fixes https://github.com/llvm/llvm-project/issues/94446

---
Full diff: https://github.com/llvm/llvm-project/pull/95677.diff


1 Files Affected:

- (modified) llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp (+2-4) 


``````````diff
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 6623106109316..d338607acbabe 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -473,7 +473,8 @@ class X86AsmParser : public MCTargetAsmParser {
     unsigned getLength() const { return CurType.Length; }
     int64_t getImm() { return Imm + IC.execute(); }
     bool isValidEndState() const {
-      return State == IES_RBRAC || State == IES_INTEGER;
+      return State == IES_RBRAC || State == IES_RPAREN ||
+             State == IES_INTEGER || State == IES_REGISTER;
     }
 
     // Is the intel expression appended after an operand index.
@@ -1897,9 +1898,6 @@ bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) {
     case AsmToken::Error:
       return Error(getLexer().getErrLoc(), getLexer().getErr());
       break;
-    case AsmToken::EndOfStatement:
-      Done = true;
-      break;
     case AsmToken::Real:
       // DotOperator: [ebx].0
       UpdateLocLex = false;

``````````

</details>


https://github.com/llvm/llvm-project/pull/95677


More information about the llvm-commits mailing list