[LLVMdev] clang promoting local to global

Eli Friedman eli.friedman at gmail.com
Wed Aug 15 11:33:03 PDT 2012


On Wed, Aug 15, 2012 at 11:26 AM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> I have a const array allocated inside a function and the IR is showing this
> has a global function (ie. there is no allocation for the space inside the
> function).
>
> For example:
>
> const int32 local_array[256] = {constValue, constValue, ..... }
>
> Is there any particular reason this may be occuring?

It's an optimization; IIRC, you can turn it off with -fno-merge-all-constants.

-Eli



More information about the llvm-dev mailing list