Sometimes (rarely) nodes held in LegalizeTypes

maps can be deleted.  This happens when RAUW
replaces a node N with another equivalent node
E, deleting the first node.  Solve this by
adding (N, E) to ReplacedNodes, which is already
used to remap nodes to replacements.  This means
that deleted nodes are being allowed in maps,
which can be delicate: the memory may be reused
for a new node which might get confused with the
old deleted node pointer hanging around in the
maps, so detect this and flush out maps if it
occurs (ExpungeNode).  The expunging operation
is expensive, however it never occurs during
a llvm-gcc bootstrap or anywhere in the nightly
testsuite.  It occurs three times in "make check":
Alpha/illegal-element-type.ll,
PowerPC/illegal-element-type.ll and
X86/mmx-shift.ll.  If expunging proves to be too
expensive then there are other more complicated
ways of solving the problem.
In the normal case this patch adds the overhead
of a few more map lookups, which is hopefully
negligable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52214 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands
2008-06-11 11:42:12 +00:00
parent a068fd32e2
commit edfcf598fa
6 changed files with 110 additions and 72 deletions

View File

@@ -95,14 +95,14 @@ class VISIBILITY_HIDDEN ISelQueueUpdater :
: ISelQueue(isq), HadDelete(false) {}
bool hadDelete() const { return HadDelete; }
/// NodeDeleted - remove node from the selection queue.
virtual void NodeDeleted(SDNode *N) {
virtual void NodeDeleted(SDNode *N, SDNode *E) {
ISelQueue.erase(std::remove(ISelQueue.begin(), ISelQueue.end(), N),
ISelQueue.end());
HadDelete = true;
}
/// NodeUpdated - Ignore updates for now.
virtual void NodeUpdated(SDNode *N) {}
};