mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
Change the "Cannot merge two portions of the same node yet" from an assertion
into a "oh crap, lets collapse" case git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4530 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4d5f10f8d6
commit
02606637e0
@ -347,18 +347,25 @@ void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) {
|
|||||||
if (N == 0 || (N == this && NH.getOffset() == Offset))
|
if (N == 0 || (N == this && NH.getOffset() == Offset))
|
||||||
return; // Noop
|
return; // Noop
|
||||||
|
|
||||||
assert(NH.getNode() != this &&
|
if (N == this) {
|
||||||
"Cannot merge two portions of the same node yet!");
|
std::cerr << "WARNING: Cannot merge two portions of the same node yet, so we collapse instead!\n";
|
||||||
|
N->foldNodeCompletely();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If we are merging a node with a completely folded node, then both nodes are
|
// If we are merging a node with a completely folded node, then both nodes are
|
||||||
// now completely folded.
|
// now completely folded.
|
||||||
//
|
//
|
||||||
if (isNodeCompletelyFolded()) {
|
if (isNodeCompletelyFolded()) {
|
||||||
N->foldNodeCompletely();
|
if (!N->isNodeCompletelyFolded())
|
||||||
} else if (NH.getNode()->isNodeCompletelyFolded()) {
|
N->foldNodeCompletely();
|
||||||
|
} else if (N->isNodeCompletelyFolded()) {
|
||||||
foldNodeCompletely();
|
foldNodeCompletely();
|
||||||
Offset = 0;
|
Offset = 0;
|
||||||
}
|
}
|
||||||
|
N = NH.getNode();
|
||||||
|
|
||||||
|
if (this == N) return;
|
||||||
|
|
||||||
// If both nodes are not at offset 0, make sure that we are merging the node
|
// If both nodes are not at offset 0, make sure that we are merging the node
|
||||||
// at an later offset into the node with the zero offset.
|
// at an later offset into the node with the zero offset.
|
||||||
@ -401,7 +408,7 @@ void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) {
|
|||||||
DSNodeHandle &Ref = *N->Referrers.back();
|
DSNodeHandle &Ref = *N->Referrers.back();
|
||||||
Ref = DSNodeHandle(this, NOffset+Ref.getOffset());
|
Ref = DSNodeHandle(this, NOffset+Ref.getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
// We must merge fields in this node due to nodes merged in the source node.
|
// We must merge fields in this node due to nodes merged in the source node.
|
||||||
// In order to handle this we build a map that converts from the source node's
|
// In order to handle this we build a map that converts from the source node's
|
||||||
// MergeMap values to our MergeMap values. This map is indexed by the
|
// MergeMap values to our MergeMap values. This map is indexed by the
|
||||||
@ -440,7 +447,7 @@ void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) {
|
|||||||
//
|
//
|
||||||
for (unsigned i = 0, e = NSize; i != e; ++i)
|
for (unsigned i = 0, e = NSize; i != e; ++i)
|
||||||
if (DSNodeHandle *Link = N->getLink(i)) {
|
if (DSNodeHandle *Link = N->getLink(i)) {
|
||||||
addEdgeTo(i+NOffset, *Link);
|
addEdgeTo((i+NOffset) % getSize(), *Link);
|
||||||
N->MergeMap[i] = -1; // Kill outgoing edge
|
N->MergeMap[i] = -1; // Kill outgoing edge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user