[LLVMdev] Compiler opt is turned off ?

Daniel Berlin dberlin at dberlin.org
Fri Jan 4 09:13:33 PST 2013

I'm not sure what you mean by "use" check.
If you compile this with LTO and multiple modules, and guarantee that
you have the main function, yes, you could optimize this.
In all other cases, it's not possible to eliminate any of the
remaining loads or stores you see, because you have no guarantee about
what else could read it.

Heck, a conforming implementation of printf could read from any of
these globals, so you don't even need other modules.

On Fri, Jan 4, 2013 at 11:45 AM, Somenath Chakraborty
<some.chak at gmail.com> wrote:
> Thanks for your reply. So, we don't do any "use" check (for globals
> variables) beyond a module scope. If so, it answers my question.
> On Fri, Jan 4, 2013 at 6:53 PM, Justin Holewinski
> <justin.holewinski at gmail.com> wrote:
>> Since a, b, and c are globals, how does the optimize *know* they are not
>> used elsewhere (e.g. another module)?
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list