[llvm-commits] preserve pointer roots in globals

Nick Lewycky nlewycky at google.com
Thu Jun 28 20:08:42 PDT 2012

The attached patch improves the interaction between GlobalOpt and leak
checkers. One of the things that GlobalOpt will do is delete all the stores
to a global that isn't loaded. If for some reason we don't mop up the
malloc/new which was being stored in that global, a leak checker will

The patch handles this by not deleting stores to globals in the above case,
when the global is known to be a pointer type, or a composite type that
contains one. We do delete stores of Constant, since those are trivially
not derived from calling an allocator. There's more analysis we could do
here to win back optimization if it turns out to be really important.

Please review!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120628/7d9f57c8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: globalopt-ptrroots-1.patch
Type: application/octet-stream
Size: 6443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120628/7d9f57c8/attachment.obj>

More information about the llvm-commits mailing list