diff options
author | Chris Lattner <sabre@nondot.org> | 2003-11-08 21:55:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-11-08 21:55:50 +0000 |
commit | 12dd38aa99c3fd01dd76bdcb5543370df102ba55 (patch) | |
tree | c73fb1bc44b889b516856bd851657c253da4709c /llvm/lib/Analysis/DataStructure | |
parent | c129e009eb065e3cd8ea9ce505a7ffe214efcf52 (diff) | |
download | bcm5719-llvm-12dd38aa99c3fd01dd76bdcb5543370df102ba55.tar.gz bcm5719-llvm-12dd38aa99c3fd01dd76bdcb5543370df102ba55.zip |
Handle bzero and memset in the local analysis, because we were missing the fact
that memset returns its argument!!
llvm-svn: 9811
Diffstat (limited to 'llvm/lib/Analysis/DataStructure')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h | 3 | ||||
-rw-r--r-- | llvm/lib/Analysis/DataStructure/Local.cpp | 18 |
2 files changed, 17 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h b/llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h index 4815c6e8a0e..324111cffad 100644 --- a/llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h +++ b/llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h @@ -39,8 +39,7 @@ struct DSCallSiteIterator { return F->getName() == "printf" || F->getName() == "sscanf" || F->getName() == "fprintf" || F->getName() == "open" || F->getName() == "sprintf" || F->getName() == "fputs" || - F->getName() == "fscanf" || F->getName() == "bzero" || - F->getName() == "memset"; + F->getName() == "fscanf"; } // isUnresolvableFunction - Return true if this is an unresolvable diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp index 689373ee7d2..f3406b76990 100644 --- a/llvm/lib/Analysis/DataStructure/Local.cpp +++ b/llvm/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; } |