]> granicus.if.org Git - llvm/commitdiff
[TableGen] Do not assume that the first variant is the original pattern
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 16 Jun 2017 13:44:34 +0000 (13:44 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 16 Jun 2017 13:44:34 +0000 (13:44 +0000)
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.

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

utils/TableGen/CodeGenDAGPatterns.cpp

index 231a6ad5706bc5ee3017e6e457a3d54267e3026e..7c41d9fad6960795046b820329f506b7a3ea226d 100644 (file)
@@ -3808,9 +3808,7 @@ void CodeGenDAGPatterns::GenerateVariants() {
                        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: ";