[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Nov 10 01:47:01 PST 2002
Changes in directory llvm/lib/Analysis/DataStructure:
DataStructure.cpp updated: 1.62 -> 1.63
---
Log message:
Fix a bug that could trigger when varargs call sites had non-matching number of arguments
---
Diffs of the changes:
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.62 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.63
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.62 Sun Nov 10 00:59:55 2002
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sun Nov 10 01:46:08 2002
@@ -773,7 +773,7 @@
//
bool DSGraph::isNodeDead(DSNode *N) {
// Is it a trivially dead shadow node?
- return N->getReferrers().empty() && (N->NodeType & ~DSNode::DEAD) == 0
+ return N->getReferrers().empty() && (N->NodeType & ~DSNode::DEAD) == 0;
}
static inline void killIfUselessEdge(DSNodeHandle &Edge) {
@@ -831,9 +831,16 @@
NumDuplicateCalls > 20) {
DSCallSite &OCS = Calls[i-1];
OCS.getRetVal().mergeWith(CS.getRetVal());
- for (unsigned a = 0, e = CS.getNumPtrArgs(); a != e; ++a)
+
+ for (unsigned a = 0,
+ e = std::min(CS.getNumPtrArgs(), OCS.getNumPtrArgs());
+ a != e; ++a)
OCS.getPtrArg(a).mergeWith(CS.getPtrArg(a));
// The node will now be eliminated as a duplicate!
+ if (CS.getNumPtrArgs() < OCS.getNumPtrArgs())
+ CS = OCS;
+ else if (CS.getNumPtrArgs() > OCS.getNumPtrArgs())
+ OCS = CS;
}
} else {
LastCalleeNode = CS.getCallee().getNode();
More information about the llvm-commits
mailing list