aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-26 07:28:20 +0000
committerChris Lattner <sabre@nondot.org>2010-02-26 07:28:20 +0000
commit00947ee2dbcd1c499c2dda9cdaa72c6a3c8fbb24 (patch)
treee41d20a2080692b7148ad57002beb548be12a17c
parent917733eca0b5d25aeb86dc5793f898932926851c (diff)
fix the matcher in the presence of multiple scopes: we need to save
and restore the entire matcher stack by value. This is because children we're testing could do moveparent or other things besides just scribbling on additions to the stack. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97212 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CodeGen/DAGISelHeader.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/DAGISelHeader.h b/include/llvm/CodeGen/DAGISelHeader.h
index 003caf1b9e..67b4155cf4 100644
--- a/include/llvm/CodeGen/DAGISelHeader.h
+++ b/include/llvm/CodeGen/DAGISelHeader.h
@@ -283,8 +283,8 @@ struct MatchScope {
/// FailIndex - If this match fails, this is the index to continue with.
unsigned FailIndex;
- /// NodeStackSize - The size of the node stack when the scope was formed.
- unsigned NodeStackSize;
+ /// NodeStack - The node stack when the scope was formed.
+ SmallVector<SDValue, 4> NodeStack;
/// NumRecordedNodes - The number of recorded nodes when the scope was formed.
unsigned NumRecordedNodes;
@@ -383,7 +383,7 @@ SDNode *SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
// to match.
MatchScope NewEntry;
NewEntry.FailIndex = MatcherIndex+NumToSkip;
- NewEntry.NodeStackSize = NodeStack.size();
+ NewEntry.NodeStack.append(NodeStack.begin(), NodeStack.end());
NewEntry.NumRecordedNodes = RecordedNodes.size();
NewEntry.NumMatchedMemRefs = MatchedMemRefs.size();
NewEntry.InputChain = InputChain;
@@ -935,7 +935,8 @@ SDNode *SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
// formed.
MatchScope &LastScope = MatchScopes.back();
RecordedNodes.resize(LastScope.NumRecordedNodes);
- NodeStack.resize(LastScope.NodeStackSize);
+ NodeStack.clear();
+ NodeStack.append(LastScope.NodeStack.begin(), LastScope.NodeStack.end());
N = NodeStack.back();
DEBUG(errs() << " Match failed at index " << MatcherIndex