If a call to getTruncStore is for a normal store,

offload to getStore rather than trying to handle
both cases at once (the assertions for example
assume the store really is truncating).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43498 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands 2007-10-30 12:40:58 +00:00
parent 6e3a8f3dfb
commit ba3b1d10fd

View File

@ -2460,7 +2460,9 @@ SDOperand SelectionDAG::getTruncStore(SDOperand Chain, SDOperand Val,
int SVOffset, MVT::ValueType SVT, int SVOffset, MVT::ValueType SVT,
bool isVolatile, unsigned Alignment) { bool isVolatile, unsigned Alignment) {
MVT::ValueType VT = Val.getValueType(); MVT::ValueType VT = Val.getValueType();
bool isTrunc = VT != SVT;
if (VT == SVT)
return getStore(Chain, Val, Ptr, SV, SVOffset, isVolatile, Alignment);
assert(MVT::getSizeInBits(VT) > MVT::getSizeInBits(SVT) && assert(MVT::getSizeInBits(VT) > MVT::getSizeInBits(SVT) &&
"Not a truncation?"); "Not a truncation?");
@ -2485,7 +2487,7 @@ SDOperand SelectionDAG::getTruncStore(SDOperand Chain, SDOperand Val,
FoldingSetNodeID ID; FoldingSetNodeID ID;
AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4);
ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(ISD::UNINDEXED);
ID.AddInteger(isTrunc); ID.AddInteger(1);
ID.AddInteger((unsigned int)SVT); ID.AddInteger((unsigned int)SVT);
ID.AddPointer(SV); ID.AddPointer(SV);
ID.AddInteger(SVOffset); ID.AddInteger(SVOffset);
@ -2494,7 +2496,7 @@ SDOperand SelectionDAG::getTruncStore(SDOperand Chain, SDOperand Val,
void *IP = 0; void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0); return SDOperand(E, 0);
SDNode *N = new StoreSDNode(Ops, VTs, ISD::UNINDEXED, isTrunc, SDNode *N = new StoreSDNode(Ops, VTs, ISD::UNINDEXED, true,
SVT, SV, SVOffset, Alignment, isVolatile); SVT, SV, SVOffset, Alignment, isVolatile);
CSEMap.InsertNode(N, IP); CSEMap.InsertNode(N, IP);
AllNodes.push_back(N); AllNodes.push_back(N);