Return Expand from getOperationAction for all extended
types. This is needed for SIGN_EXTEND_INREG at least.
It is not clear if this is correct for other operations.
On the other hand, for the various load/store actions
it seems to correct to return the type action, as is
currently done.
Also, it seems that SelectionDAG::getValueType can be
called for extended value types; introduce a map for
holding these, since we don't really want to extend
the vector to be 2^32 pointers long!
Generalize DAGTypeLegalizer::PromoteResult_TRUNCATE
and DAGTypeLegalizer::PromoteResult_INT_EXTEND to handle
the various funky possibilities that apints introduce,
for example that you can promote to a type that needs
to be expanded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43071 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index b0c949e..e6ce2eb 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -527,10 +527,16 @@
Erased =
TargetExternalSymbols.erase(cast<ExternalSymbolSDNode>(N)->getSymbol());
break;
- case ISD::VALUETYPE:
- Erased = ValueTypeNodes[cast<VTSDNode>(N)->getVT()] != 0;
- ValueTypeNodes[cast<VTSDNode>(N)->getVT()] = 0;
+ case ISD::VALUETYPE: {
+ MVT::ValueType VT = cast<VTSDNode>(N)->getVT();
+ if (MVT::isExtendedVT(VT)) {
+ Erased = ExtendedValueTypeNodes.erase(VT);
+ } else {
+ Erased = ValueTypeNodes[VT] != 0;
+ ValueTypeNodes[VT] = 0;
+ }
break;
+ }
default:
// Remove it from the CSE Map.
Erased = CSEMap.RemoveNode(N);
@@ -847,15 +853,16 @@
}
SDOperand SelectionDAG::getValueType(MVT::ValueType VT) {
- assert(!MVT::isExtendedVT(VT) && "Expecting a simple value type!");
- if ((unsigned)VT >= ValueTypeNodes.size())
+ if (!MVT::isExtendedVT(VT) && (unsigned)VT >= ValueTypeNodes.size())
ValueTypeNodes.resize(VT+1);
- if (ValueTypeNodes[VT] == 0) {
- ValueTypeNodes[VT] = new VTSDNode(VT);
- AllNodes.push_back(ValueTypeNodes[VT]);
- }
- return SDOperand(ValueTypeNodes[VT], 0);
+ SDNode *&N = MVT::isExtendedVT(VT) ?
+ ExtendedValueTypeNodes[VT] : ValueTypeNodes[VT];
+
+ if (N) return SDOperand(N, 0);
+ N = new VTSDNode(VT);
+ AllNodes.push_back(N);
+ return SDOperand(N, 0);
}
SDOperand SelectionDAG::getExternalSymbol(const char *Sym, MVT::ValueType VT) {