just like they can opt into getting the root of the pattern being
[oota-llvm.git] / lib / CodeGen / SelectionDAG / SelectionDAGISel.cpp
index dead5d50b72bea03b9769d5bd59f04abb62b6d17..7b2898dcbfb77c5592d85b6e28f8b70f5b35d5fa 100644 (file)
@@ -2086,7 +2086,11 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
       unsigned CPNum = MatcherTable[MatcherIndex++];
       unsigned RecNo = MatcherTable[MatcherIndex++];
       assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat");
-      if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo], CPNum,
+      SDNode *Parent = 0;
+      if (NodeStack.size() > 1)
+        Parent = NodeStack[NodeStack.size()-2].getNode();
+      
+      if (!CheckComplexPattern(NodeToMatch, Parent, RecordedNodes[RecNo], CPNum,
                                RecordedNodes))
         break;
       continue;