OSDN Git Service

[TableGen] Avoid self getPredicates() != comparison. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 16 Aug 2018 16:04:05 +0000 (16:04 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 16 Aug 2018 16:04:05 +0000 (16:04 +0000)
We were performing a completely unnecessary full comparison of the same std::vector<Predicate>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339888 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CodeGenDAGPatterns.cpp

index 85285db..5bf84da 100644 (file)
@@ -4483,8 +4483,8 @@ void CodeGenDAGPatterns::GenerateVariants() {
       bool AlreadyExists = false;
       for (unsigned p = 0, e = PatternsToMatch.size(); p != e; ++p) {
         // Skip if the top level predicates do not match.
-        if (PatternsToMatch[i].getPredicates() !=
-            PatternsToMatch[p].getPredicates())
+        if ((i != p) && (PatternsToMatch[i].getPredicates() !=
+                         PatternsToMatch[p].getPredicates()))
           continue;
         // Check to see if this variant already exists.
         if (Variant->isIsomorphicTo(PatternsToMatch[p].getSrcPattern(),