[llvm-commits] preserve pointer roots in globals

Duncan Sands baldrick at free.fr
Fri Jun 29 00:34:14 PDT 2012


Hi Nick,

> 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 complain.

if the malloc cleanup code sees that the malloc result is stored to a global,
then won't that prevent it from removing the malloc?  In short, isn't it
important to remove such dead stores exactly because you then have a chance of
deleting the malloc call?

Also, isn't the leak checker right to complain, and the fact that it doesn't
complain when the value is stored to the global just a weakness of the leak
checker?  After all, if without the store the memory leaked, then with the
store the memory leaked too, since the global is never read.  So aren't you
just hiding real leaks here?

This patch seems completely backwards to how it should be to me.

Ciao, Duncan.

>
> 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!
>
> Nick
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>





More information about the llvm-commits mailing list