[llvm] r339888 - [TableGen] Avoid self getPredicates() != comparison. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 16 09:04:06 PDT 2018


Author: rksimon
Date: Thu Aug 16 09:04:05 2018
New Revision: 339888

URL: http://llvm.org/viewvc/llvm-project?rev=339888&view=rev
Log:
[TableGen] Avoid self getPredicates() != comparison. NFCI.

We were performing a completely unnecessary full comparison of the same std::vector<Predicate>.

Modified:
    llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp

Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=339888&r1=339887&r2=339888&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Thu Aug 16 09:04:05 2018
@@ -4483,8 +4483,8 @@ void CodeGenDAGPatterns::GenerateVariant
       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(),




More information about the llvm-commits mailing list