aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/DataStructure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-22 16:31:08 +0000
committerChris Lattner <sabre@nondot.org>2004-01-22 16:31:08 +0000
commit5254a8dda8816c4fb27d37c5733c8f5fec483a76 (patch)
tree9e24971e972dc8220c40433927515b512869f6ad /lib/Analysis/DataStructure/DataStructure.cpp
parent9a37f2d96a195e0b7f28605e8b642d04c9cc30ca (diff)
Bug fix: X.mergeWith(Y) was not updating Y if Y was a null node handle!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10953 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index caabff8d19..043579c72f 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -679,13 +679,20 @@ void DSNode::MergeNodes(DSNodeHandle& CurNodeH, DSNodeHandle& NH) {
// Offset indicates what offset the specified node is to be merged into the
// current node.
//
-// The specified node may be a null pointer (in which case, nothing happens).
+// The specified node may be a null pointer (in which case, we update it to
+// point to this node).
//
void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) {
DSNode *N = NH.getNode();
- if (N == 0 || (N == this && NH.getOffset() == Offset))
+ if (N == this && NH.getOffset() == Offset)
return; // Noop
+ // If the RHS is a null node, make it point to this node!
+ if (N == 0) {
+ NH.mergeWith(DSNodeHandle(this, Offset));
+ return;
+ }
+
assert(!N->isDeadNode() && !isDeadNode());
assert(!hasNoReferrers() && "Should not try to fold a useless node!");