[LLVMdev] clang optimizer does not remove unused/uneeded variables(and accesses) from global scope

Dimitry Andric dimitry at andric.com
Thu Jul 5 04:30:27 PDT 2012


On 2012-07-05 12:53, Dennis Luehring wrote:
> addition to my last post: 
> http://groups.google.com/group/llvm-dev/browse_thread/thread/afd85c3f303ec2a9
> 
> i know that using static on my globals will remove them - no other 
> compilation unit can then extern the vars
> 
> but my question is - in this closed szenario clang is "directly" 
> producing the exe - isn't clang aware of that the vars are not in use?

It can't know that, unless you use link-time optimization.  Which
optimization level did you use?



More information about the llvm-dev mailing list