llvm-mc/AsmParser: Fix thinko in ClassInfo::operator<.
authorDaniel Dunbar <daniel@zuster.org>
Sun, 9 Aug 2009 08:23:23 +0000 (08:23 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 9 Aug 2009 08:23:23 +0000 (08:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78533 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmMatcherEmitter.cpp

index a13bc4e0b953da2f6289e4a60750ab19082b02a9..ef9ab20553311a7fef79627895c8e81937c67052 100644 (file)
@@ -396,10 +396,15 @@ struct InstructionInfo {
     if (Operands.size() != RHS.Operands.size())
       return Operands.size() < RHS.Operands.size();
 
-    for (unsigned i = 0, e = Operands.size(); i != e; ++i)
+    // Compare lexicographically by operand. The matcher validates that other
+    // orderings wouldn't be ambiguous using \see CouldMatchAmiguouslyWith().
+    for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
       if (*Operands[i].Class < *RHS.Operands[i].Class)
         return true;
-    
+      if (*RHS.Operands[i].Class < *Operands[i].Class)
+        return false;
+    }
+
     return false;
   }