[PATCH 1/3] Add new keyword externally_initialized to LLVM.

John McCall rjmccall at apple.com
Fri Feb 1 16:36:26 PST 2013


On Feb 1, 2013, at 3:01 PM, Sean Silva <silvas at purdue.edu> wrote:
> +By default, LLVM optimizes global initializers by assuming that global
> +variables defined within the module are not modified from their
> +initial values before the start of the global initializer.
> 
> Is this assumption documented anywhere else in LangRef?

I don't think so.  I agree that it ought to be;  I'm not sure where.

> If not, then this creates a normative specification about the
> semantics of globals in LLVM IR. I'm not saying whether that is good
> or bad, but is it intentional?

It is at least the apparent existing semantics of IR.  Arguably the default
semantics ought to be reversed, but that would be a very invasive change.

> If so, I would rather add this specification in a separate patch fixing the
> omission (it is essentially fixing a documentation bug (unspecified aspect
> of the language); no need to confuse that change with adding a new
> language feature).

This is a fair point.

John.



More information about the llvm-commits mailing list