So there are some #define (defined outside the function scope) that use it_tab that are used inside the function, is this why it is promoting it to a global?<br><br><div class="gmail_quote">On Wed, Aug 15, 2012 at 2:57 PM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">#define r10(p,q,r,s) 0x##s##r##q##p<br>   #undef r<br>   #define r r10<br>    const word it_tab[4][256] = { r(const, const, const, const), r(.......), r(.......) ....... };<br>
<br>All of this is done inside the function I want the alloc in. The variable is not declared/defined/used anywhere else.<div class="HOEnZb"><div class="h5"><br>
<br><br><br><div class="gmail_quote">On Wed, Aug 15, 2012 at 12:00 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On Wed, Aug 15, 2012 at 11:40 AM, Ryan Taylor <<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>> wrote:<br>
> Eli, thanks for responding, unfortunately, this did not resolve my issue.<br>
> It's a locally allocated array in the C code, but I'm not seeing any alloca<br>
> in the IR just geps from the variable, which is never setup.<br>
<br>
</div>That's strange; I just checked, and -fno-merge-all-constants<br>
definitely does have an effect for a simple testcase like the<br>
following (just using clang -emit-llvm at -O0):<br>
<br>
void f() { const int x[5] = {1,2,3,4}; }<br>
<br>
What does your testcase look like?<br>
<span><font color="#888888"><br>
-Eli<br>
</font></span></blockquote></div><br>
</div></div></blockquote></div><br>