summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-07 06:12:52 +0000
committerChris Lattner <sabre@nondot.org>2004-07-07 06:12:52 +0000
commitdeb7676f0fa3c374d5bc14ff22a41051526a9d92 (patch)
tree417a522b2b9096eb214f2eebb16a082db4e93783 /llvm/lib/Analysis/DataStructure/DataStructure.cpp
parent71068a046218544b56392f9fae43af2b780183aa (diff)
downloadbcm5719-llvm-deb7676f0fa3c374d5bc14ff22a41051526a9d92.tar.gz
bcm5719-llvm-deb7676f0fa3c374d5bc14ff22a41051526a9d92.zip
As much as I hate to say it, the whole setNode interface for DSNodeHandles
is HOPELESSLY broken. The problem is that the embedded getNode call can change the offset of the node handle in unpredictable ways. As it turns out, all of the clients of this method really want to set both the node and the offset, thus it is more efficient (and less buggy) to just do both of them in one method call. This fixes some obscure bugs handling non-forwarded node handles. llvm-svn: 14660
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r--llvm/lib/Analysis/DataStructure/DataStructure.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
index 53c39f9047c..7b0ddba8055 100644
--- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
@@ -120,8 +120,7 @@ void DSNode::forwardNode(DSNode *To, unsigned Offset) {
if (To->Size <= 1) Offset = 0;
assert((Offset < To->Size || (Offset == To->Size && Offset == 0)) &&
"Forwarded offset is wrong!");
- ForwardNH.setNode(To);
- ForwardNH.setOffset(Offset);
+ ForwardNH.setTo(To, Offset);
NodeType = DEAD;
Size = 0;
Ty = Type::VoidTy;
@@ -1096,10 +1095,9 @@ void DSNode::remapLinks(DSGraph::NodeMapTy &OldNodeMap) {
for (unsigned i = 0, e = Links.size(); i != e; ++i)
if (DSNode *N = Links[i].getNode()) {
DSGraph::NodeMapTy::const_iterator ONMI = OldNodeMap.find(N);
- if (ONMI != OldNodeMap.end()) {
- Links[i].setNode(ONMI->second.getNode());
- Links[i].setOffset(Links[i].getOffset()+ONMI->second.getOffset());
- }
+ if (ONMI != OldNodeMap.end())
+ Links[i].setTo(ONMI->second.getNode(),
+ Links[i].getOffset()+ONMI->second.getOffset());
}
}
@@ -1475,7 +1473,7 @@ static inline void killIfUselessEdge(DSNodeHandle &Edge) {
// No interesting info?
if ((N->getNodeFlags() & ~DSNode::Incomplete) == 0 &&
N->getType() == Type::VoidTy && !N->isNodeCompletelyFolded())
- Edge.setNode(0); // Kill the edge!
+ Edge.setTo(0, 0); // Kill the edge!
}
static inline bool nodeContainsExternalFunction(const DSNode *N) {
@@ -1979,8 +1977,7 @@ void DSGraph::computeNodeMapping(const DSNodeHandle &NH1,
return;
}
- Entry.setNode(N2);
- Entry.setOffset(NH2.getOffset()-NH1.getOffset());
+ Entry.setTo(N2, NH2.getOffset()-NH1.getOffset());
// Loop over all of the fields that N1 and N2 have in common, recursively
// mapping the edges together now.
OpenPOWER on IntegriCloud