[LLVMdev] clang promoting local to global

Eli Friedman eli.friedman at gmail.com
Wed Aug 15 12:00:46 PDT 2012


On Wed, Aug 15, 2012 at 11:40 AM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> Eli, thanks for responding, unfortunately, this did not resolve my issue.
> It's a locally allocated array in the C code, but I'm not seeing any alloca
> in the IR just geps from the variable, which is never setup.

That's strange; I just checked, and -fno-merge-all-constants
definitely does have an effect for a simple testcase like the
following (just using clang -emit-llvm at -O0):

void f() { const int x[5] = {1,2,3,4}; }

What does your testcase look like?

-Eli



More information about the llvm-dev mailing list