Fix recognition of allocators.
Make all kernel allocators and I/O allocators except kmem_cache_alloc()
allocate type-unknown memory objects.
llvm-svn: 63547
diff --git a/poolalloc/lib/DSA/Local.cpp b/poolalloc/lib/DSA/Local.cpp
index 809e086..c811fab 100644
--- a/poolalloc/lib/DSA/Local.cpp
+++ b/poolalloc/lib/DSA/Local.cpp
@@ -1513,10 +1513,23 @@
RetNH = getValueDest(*CS.getInstruction());
RetNH.getNode()->setHeapNodeMarker()->setModifiedMarker();
RetNH.getNode()->getMP()->addCallSite(CS);
+
+ //
+ // Anything that is not a pool allocator must mark objects as
+ // type-unknown.
+ //
+ if (F->getName() != "kmem_cache_alloc")
+ RetNH.getNode()->foldNodeCompletely();
return;
}
#ifdef SVA_IO
+ //
+ // Determine whether this is a call to a function that allocates an I/O
+ // object. If so, then make it with the I/O flags and make it
+ // type-unknown (as the I/O device may treat the memory as a type different
+ // than what we infer).
+ //
if (IOAllocList.end() != std::find(IOAllocList.begin(), IOAllocList.end(), F->getName())) {
DSNodeHandle RetNH;
if (F->getName() == "pseudo_alloc")
@@ -1525,6 +1538,7 @@
RetNH = getValueDest(*CS.getInstruction());
RetNH.getNode()->setIONodeMarker()->setModifiedMarker();
RetNH.getNode()->getMP()->addCallSite(CS);
+ RetNH.getNode()->foldNodeCompletely();
return;
}
#endif
@@ -1815,7 +1829,7 @@
AllocList.push_back("__vmalloc");
AllocList.push_back("kmem_cache_alloc");
AllocList.push_back("__alloc_bootmem");
- AllocList.push_back(" __get_free_pages");
+ AllocList.push_back("__get_free_pages");
AllocList.push_back("pseudo_alloc");
AllocList.push_back("malloc");