summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit2a0bc1224de0101493d2e9be8c8df0860529646c (patch)
tree16d98df520e1955f3d3b09c837560ee16267af53 /llvm/lib/Analysis/DataStructure/DataStructure.cpp
parent94f4b2a78b169dfd7a64d65a0e2dacfc0c44a8bc (diff)
downloadbcm5719-llvm-2a0bc1224de0101493d2e9be8c8df0860529646c.tar.gz
bcm5719-llvm-2a0bc1224de0101493d2e9be8c8df0860529646c.zip
Bug fix: X.mergeWith(Y) was not updating Y if Y was a null node handle!
llvm-svn: 10953
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r--llvm/lib/Analysis/DataStructure/DataStructure.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
index caabff8d19c..043579c72f5 100644
--- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/llvm/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!");
OpenPOWER on IntegriCloud