[llvm-commits] [llvm] r47546 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
Duncan Sands
baldrick at free.fr
Mon Feb 25 08:21:22 PST 2008
Author: baldrick
Date: Mon Feb 25 10:21:21 2008
New Revision: 47546
URL: http://llvm.org/viewvc/llvm-project?rev=47546&view=rev
Log:
In debug builds check that the key property holds: all
result and operand types are legal.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=47546&r1=47545&r2=47546&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Mon Feb 25 10:21:21 2008
@@ -173,18 +173,36 @@
#ifndef NDEBUG
for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
E = DAG.allnodes_end(); I != E; ++I) {
- if (I->getNodeId() == Processed)
- continue;
- cerr << "Unprocessed node: ";
- I->dump(&DAG); cerr << "\n";
-
- if (I->getNodeId() == NewNode)
- cerr << "New node not 'noticed'?\n";
- else if (I->getNodeId() > 0)
- cerr << "Operand not processed?\n";
- else if (I->getNodeId() == ReadyToProcess)
- cerr << "Not added to worklist?\n";
- abort();
+ bool Failed = false;
+
+ // Check that all result types are legal.
+ for (unsigned i = 0, NumVals = I->getNumValues(); i < NumVals; ++i)
+ if (!isTypeLegal(I->getValueType(i))) {
+ cerr << "Result type " << i << " illegal!\n";
+ Failed = true;
+ }
+
+ // Check that all operand types are legal.
+ for (unsigned i = 0, NumOps = I->getNumOperands(); i < NumOps; ++i)
+ if (!isTypeLegal(I->getOperand(i).getValueType())) {
+ cerr << "Operand type " << i << " illegal!\n";
+ Failed = true;
+ }
+
+ if (I->getNodeId() != Processed) {
+ if (I->getNodeId() == NewNode)
+ cerr << "New node not 'noticed'?\n";
+ else if (I->getNodeId() > 0)
+ cerr << "Operand not processed?\n";
+ else if (I->getNodeId() == ReadyToProcess)
+ cerr << "Not added to worklist?\n";
+ Failed = true;
+ }
+
+ if (Failed) {
+ I->dump(&DAG); cerr << "\n";
+ abort();
+ }
}
#endif
}
More information about the llvm-commits
mailing list