forked from OSchip/llvm-project
Don't allocate empty read-only SmallVectors during SelectionDAG deallocation.
llvm-svn: 133348
This commit is contained in:
parent
25e17b0f89
commit
e1fc29b6ac
llvm
|
@ -96,8 +96,12 @@ public:
|
||||||
return DbgValues.empty() && ByvalParmDbgValues.empty();
|
return DbgValues.empty() && ByvalParmDbgValues.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallVector<SDDbgValue*,2> &getSDDbgValues(const SDNode *Node) {
|
ArrayRef<SDDbgValue*> getSDDbgValues(const SDNode *Node) {
|
||||||
return DbgValMap[Node];
|
DenseMap<const SDNode*, SmallVector<SDDbgValue*, 2> >::iterator I =
|
||||||
|
DbgValMap.find(Node);
|
||||||
|
if (I != DbgValMap.end())
|
||||||
|
return I->second;
|
||||||
|
return ArrayRef<SDDbgValue*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef SmallVector<SDDbgValue*,32>::iterator DbgIterator;
|
typedef SmallVector<SDDbgValue*,32>::iterator DbgIterator;
|
||||||
|
@ -898,7 +902,7 @@ public:
|
||||||
void AddDbgValue(SDDbgValue *DB, SDNode *SD, bool isParameter);
|
void AddDbgValue(SDDbgValue *DB, SDNode *SD, bool isParameter);
|
||||||
|
|
||||||
/// GetDbgValues - Get the debug values which reference the given SDNode.
|
/// GetDbgValues - Get the debug values which reference the given SDNode.
|
||||||
SmallVector<SDDbgValue*,2> &GetDbgValues(const SDNode* SD) {
|
ArrayRef<SDDbgValue*> GetDbgValues(const SDNode* SD) {
|
||||||
return DbgInfo->getSDDbgValues(SD);
|
return DbgInfo->getSDDbgValues(SD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -649,7 +649,7 @@ static void ProcessSDDbgValues(SDNode *N, SelectionDAG *DAG,
|
||||||
// order number right after the N.
|
// order number right after the N.
|
||||||
MachineBasicBlock *BB = Emitter.getBlock();
|
MachineBasicBlock *BB = Emitter.getBlock();
|
||||||
MachineBasicBlock::iterator InsertPos = Emitter.getInsertPos();
|
MachineBasicBlock::iterator InsertPos = Emitter.getInsertPos();
|
||||||
SmallVector<SDDbgValue*,2> &DVs = DAG->GetDbgValues(N);
|
ArrayRef<SDDbgValue*> DVs = DAG->GetDbgValues(N);
|
||||||
for (unsigned i = 0, e = DVs.size(); i != e; ++i) {
|
for (unsigned i = 0, e = DVs.size(); i != e; ++i) {
|
||||||
if (DVs[i]->isInvalidated())
|
if (DVs[i]->isInvalidated())
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -598,7 +598,7 @@ void SelectionDAG::DeallocateNode(SDNode *N) {
|
||||||
Ordering->remove(N);
|
Ordering->remove(N);
|
||||||
|
|
||||||
// If any of the SDDbgValue nodes refer to this SDNode, invalidate them.
|
// If any of the SDDbgValue nodes refer to this SDNode, invalidate them.
|
||||||
SmallVector<SDDbgValue*, 2> &DbgVals = DbgInfo->getSDDbgValues(N);
|
ArrayRef<SDDbgValue*> DbgVals = DbgInfo->getSDDbgValues(N);
|
||||||
for (unsigned i = 0, e = DbgVals.size(); i != e; ++i)
|
for (unsigned i = 0, e = DbgVals.size(); i != e; ++i)
|
||||||
DbgVals[i]->setIsInvalidated();
|
DbgVals[i]->setIsInvalidated();
|
||||||
}
|
}
|
||||||
|
@ -5508,9 +5508,9 @@ void SelectionDAG::TransferDbgValues(SDValue From, SDValue To) {
|
||||||
return;
|
return;
|
||||||
SDNode *FromNode = From.getNode();
|
SDNode *FromNode = From.getNode();
|
||||||
SDNode *ToNode = To.getNode();
|
SDNode *ToNode = To.getNode();
|
||||||
SmallVector<SDDbgValue *, 2> &DVs = GetDbgValues(FromNode);
|
ArrayRef<SDDbgValue *> DVs = GetDbgValues(FromNode);
|
||||||
SmallVector<SDDbgValue *, 2> ClonedDVs;
|
SmallVector<SDDbgValue *, 2> ClonedDVs;
|
||||||
for (SmallVector<SDDbgValue *, 2>::iterator I = DVs.begin(), E = DVs.end();
|
for (ArrayRef<SDDbgValue *>::iterator I = DVs.begin(), E = DVs.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
SDDbgValue *Dbg = *I;
|
SDDbgValue *Dbg = *I;
|
||||||
if (Dbg->getKind() == SDDbgValue::SDNODE) {
|
if (Dbg->getKind() == SDDbgValue::SDNODE) {
|
||||||
|
|
Loading…
Reference in New Issue