TableGen: Pattern<> references to null_frag are a nop.
authorJim Grosbach <grosbach@apple.com>
Tue, 17 Jul 2012 18:39:36 +0000 (18:39 +0000)
committerJim Grosbach <grosbach@apple.com>
Tue, 17 Jul 2012 18:39:36 +0000 (18:39 +0000)
A standalone pattern defined in a multiclass expansion should handle
null_frag references just like patterns on instructions. Follow-up to
r160333.

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

utils/TableGen/CodeGenDAGPatterns.cpp

index 09c00dd4f7d88b937f3ae19c8ba3c510819a3272..34f8a34e7af7aa480293dd1af7222bf19938847c 100644 (file)
@@ -2908,6 +2908,11 @@ void CodeGenDAGPatterns::ParsePatterns() {
   for (unsigned i = 0, e = Patterns.size(); i != e; ++i) {
     Record *CurPattern = Patterns[i];
     DagInit *Tree = CurPattern->getValueAsDag("PatternToMatch");
+
+    // If the pattern references the null_frag, there's nothing to do.
+    if (hasNullFragReference(Tree))
+      continue;
+
     TreePattern *Pattern = new TreePattern(CurPattern, Tree, true, *this);
 
     // Inline pattern fragments into it.