[llvm-commits] [llvm] r160529 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll

Dan Gohman gohman at apple.com
Thu Jul 19 17:22:18 PDT 2012


On Jul 19, 2012, at 3:35 PM, Nick Lewycky <nicholas at mxc.ca> wrote:

> Author: nicholas
> Date: Thu Jul 19 17:35:28 2012
> New Revision: 160529
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=160529&view=rev
> Log:
> Don't wipe out global variables that are probably storing pointers to heap
> memory. This makes clang play nice with leak checkers.

This seems quite odd. You're modifying a general-purpose pass to
throttle an optimization, the kind which can enable further
optimizations. You're doing so on the assumption that any pointer value
which isn't a constant is a heap pointer, and the assumption that users
always want heap pointers to stick around because they'll always be
using leak checkers.

Wouldn't it be better to just tell people who are using global variables
for the purpose of manipulating their leak checkers to mark those
variables with __attribute__((used))? Then it'll work exactly as they
want, with no vague heuristics.

Dan




More information about the llvm-commits mailing list