aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/Local.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-08 21:55:50 +0000
committerChris Lattner <sabre@nondot.org>2003-11-08 21:55:50 +0000
commitfb8c61056fe63652974a81d87c42f657b9dc1260 (patch)
treebe174101897b0aea2ccb743c7a84a25ad9d741d1 /lib/Analysis/DataStructure/Local.cpp
parent52d792cec1625c331f58a40016d100cb83a26a2b (diff)
Handle bzero and memset in the local analysis, because we were missing the fact
that memset returns its argument!! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Local.cpp')
-rw-r--r--lib/Analysis/DataStructure/Local.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp
index 689373ee7d..f3406b7699 100644
--- a/lib/Analysis/DataStructure/Local.cpp
+++ b/lib/Analysis/DataStructure/Local.cpp
@@ -435,8 +435,22 @@ void GraphBuilder::visitCallSite(CallSite CS) {
} else if (F->getName() == "realloc") {
DSNodeHandle RetNH = getValueDest(*CS.getInstruction());
RetNH.mergeWith(getValueDest(**CS.arg_begin()));
- DSNode *N = RetNH.getNode();
- if (N) N->setHeapNodeMarker()->setModifiedMarker()->setReadMarker();
+ if (DSNode *N = RetNH.getNode())
+ N->setHeapNodeMarker()->setModifiedMarker()->setReadMarker();
+ return;
+ } else if (F->getName() == "memset") {
+ // Merge the first argument with the return value, and mark the memory
+ // modified.
+ DSNodeHandle RetNH = getValueDest(*CS.getInstruction());
+ RetNH.mergeWith(getValueDest(**CS.arg_begin()));
+ if (DSNode *N = RetNH.getNode())
+ N->setModifiedMarker();
+ return;
+ } else if (F->getName() == "bzero") {
+ // Mark the memory modified.
+ DSNodeHandle H = getValueDest(**CS.arg_begin());
+ if (DSNode *N = H.getNode())
+ N->setModifiedMarker();
return;
}