[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h Local.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Nov 8 15:57:01 PST 2003


Changes in directory llvm/lib/Analysis/DataStructure:

DSCallSiteIterator.h updated: 1.6 -> 1.7
Local.cpp updated: 1.67 -> 1.68

---
Log message:

Handle bzero and memset in the local analysis, because we were missing the fact
that memset returns its argument!!


---
Diffs of the changes:  (+17 -4)

Index: llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h
diff -u llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h:1.6 llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h:1.7
--- llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h:1.6	Tue Oct 21 10:17:09 2003
+++ llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h	Sat Nov  8 15:55:50 2003
@@ -39,8 +39,7 @@
     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


Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.67 llvm/lib/Analysis/DataStructure/Local.cpp:1.68
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.67	Sun Nov  2 16:27:28 2003
+++ llvm/lib/Analysis/DataStructure/Local.cpp	Sat Nov  8 15:55:50 2003
@@ -435,8 +435,22 @@
       } 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;
       }
 





More information about the llvm-commits mailing list