[llvm] r305556 - [TableGen] Do not assume that the first variant is the original pattern

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 06:44:34 PDT 2017


Author: kparzysz
Date: Fri Jun 16 08:44:34 2017
New Revision: 305556

URL: http://llvm.org/viewvc/llvm-project?rev=305556&view=rev
Log:
[TableGen] Do not assume that the first variant is the original pattern

The variant generation for commutative/associative patterns would simply
delete the first output from the list assuming that it was identical to
the original pattern. This does not have to be the case, and a legitimate
variant could actually be removed that way. 

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=305556&r1=305555&r2=305556&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Fri Jun 16 08:44:34 2017
@@ -3808,9 +3808,7 @@ void CodeGenDAGPatterns::GenerateVariant
                        DepVars);
 
     assert(!Variants.empty() && "Must create at least original variant!");
-    Variants.erase(Variants.begin());  // Remove the original pattern.
-
-    if (Variants.empty())  // No variants for this pattern.
+    if (Variants.size() == 1)  // No additional variants for this pattern.
       continue;
 
     DEBUG(errs() << "FOUND VARIANTS OF: ";




More information about the llvm-commits mailing list