aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-04-13 16:04:03 +0000
committerDuncan Sands <baldrick@free.fr>2008-04-13 16:04:03 +0000
commit4a6da60787fcc66c521288fbd139cf8afdca5957 (patch)
treeb21f83fd9fe3632e5bfadfb2fe725b9b5927c0ce /lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
parentc0cb28fd3abee9a8b40856990e04f1af2f9bd7b8 (diff)
LegalizeTypes can sometimes have deleted nodes
in its maps. Add some sanity checks that catch this kind of thing. Hopefully these can be removed one day (once all problems are fixed!) but for the moment it seems wise to have them in. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeTypes.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypes.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
index 380c42220c..34f99da49f 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
@@ -267,6 +267,51 @@ void DAGTypeLegalizer::AnalyzeNewNode(SDNode *&N) {
Worklist.push_back(N);
}
+void DAGTypeLegalizer::SanityCheck(SDNode *N) {
+ for (SmallVector<SDNode*, 128>::iterator I = Worklist.begin(),
+ E = Worklist.end(); I != E; ++I)
+ assert(*I != N);
+
+ for (DenseMap<SDOperandImpl, SDOperand>::iterator I = ReplacedNodes.begin(),
+ E = ReplacedNodes.end(); I != E; ++I) {
+ assert(I->first.Val != N);
+ assert(I->second.Val != N);
+ }
+
+ for (DenseMap<SDOperandImpl, SDOperand>::iterator I = PromotedNodes.begin(),
+ E = PromotedNodes.end(); I != E; ++I) {
+ assert(I->first.Val != N);
+ assert(I->second.Val != N);
+ }
+
+ for (DenseMap<SDOperandImpl, SDOperand>::iterator
+ I = FloatToIntedNodes.begin(),
+ E = FloatToIntedNodes.end(); I != E; ++I) {
+ assert(I->first.Val != N);
+ assert(I->second.Val != N);
+ }
+
+ for (DenseMap<SDOperandImpl, SDOperand>::iterator I = ScalarizedNodes.begin(),
+ E = ScalarizedNodes.end(); I != E; ++I) {
+ assert(I->first.Val != N);
+ assert(I->second.Val != N);
+ }
+
+ for (DenseMap<SDOperandImpl, std::pair<SDOperand, SDOperand> >::iterator
+ I = ExpandedNodes.begin(), E = ExpandedNodes.end(); I != E; ++I) {
+ assert(I->first.Val != N);
+ assert(I->second.first.Val != N);
+ assert(I->second.second.Val != N);
+ }
+
+ for (DenseMap<SDOperandImpl, std::pair<SDOperand, SDOperand> >::iterator
+ I = SplitNodes.begin(), E = SplitNodes.end(); I != E; ++I) {
+ assert(I->first.Val != N);
+ assert(I->second.first.Val != N);
+ assert(I->second.second.Val != N);
+ }
+}
+
namespace {
/// NodeUpdateListener - This class is a DAGUpdateListener that listens for
/// updates to nodes and recomputes their ready state.
@@ -281,6 +326,9 @@ namespace {
assert(N->getNodeId() != DAGTypeLegalizer::Processed &&
N->getNodeId() != DAGTypeLegalizer::ReadyToProcess &&
"RAUW deleted processed node!");
+#ifndef NDEBUG
+ DTL.SanityCheck(N);
+#endif
}
virtual void NodeUpdated(SDNode *N) {