summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/AsmMatcherEmitter.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/utils/TableGen/AsmMatcherEmitter.cpp b/utils/TableGen/AsmMatcherEmitter.cpp
index a13bc4e0b9..ef9ab20553 100644
--- a/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/utils/TableGen/AsmMatcherEmitter.cpp
@@ -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;
}