aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-08 20:35:13 +0000
committerChris Lattner <sabre@nondot.org>2005-01-08 20:35:13 +0000
commite3304a3d24afc952d3cb415d1b504d973573c5c5 (patch)
treea966d3cf5796a9919174c39522740e9f22c9bbb9
parentce45d65d9a5414e616ec605b37e840247963bb9f (diff)
Tighten up assertions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19397 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 63fcc1c2a7..19e70f5927 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -199,12 +199,12 @@ void SelectionDAGLegalize::LegalizeDAG() {
}
SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
+ assert(getTypeAction(Op.getValueType()) == Legal &&
+ "Caller should expand or promote operands that are not legal!");
+
// If this operation defines any values that cannot be represented in a
- // register on this target, make sure to expand it.
- if (Op.Val->getNumValues() == 1) {// Fast path == assertion only
- assert(getTypeAction(Op.Val->getValueType(0)) == Legal &&
- "For a single use value, caller should check for legality!");
- } else {
+ // register on this target, make sure to expand or promote them.
+ if (Op.Val->getNumValues() > 1) {
for (unsigned i = 0, e = Op.Val->getNumValues(); i != e; ++i)
switch (getTypeAction(Op.Val->getValueType(i))) {
case Legal: break; // Nothing to do.
@@ -719,9 +719,7 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
Hi = SDOperand(NC, 1);
// Insert the new chain mapping.
- bool isNew = LegalizedNodes.insert(std::make_pair(Op.getValue(1),
- Hi.getValue(2))).second;
- assert(isNew && "This node was already legalized!");
+ AddLegalizedOperand(Op.getValue(1), Hi.getValue(2));
break;
}
case ISD::AND: