[llvm] [TableGen] Fix operand constraint checking problem. (PR #85859)

David Chisnall via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 02:31:46 PDT 2024


================
@@ -325,7 +325,8 @@ static void ParseConstraint(StringRef CStr, CGIOperandList &Ops, Record *Rec) {
 
   // Only other constraint is "TIED_TO" for now.
   StringRef::size_type pos = CStr.find_first_of('=');
-  if (pos == StringRef::npos)
+  if (pos == StringRef::npos || CStr.find_first_of(" \t", pos) != (pos + 1) ||
+      CStr.find_last_of(" \t", pos) != (pos - 1))
----------------
davidchisnall wrote:

Won’t this be caught by a different check finding the two operands of an infix operator? If a constraint starts with =, the LHS is missing.

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


More information about the llvm-commits mailing list