<br><br><div class="gmail_quote">On Wed, Aug 15, 2012 at 4:10 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 class="im">On Wed, Aug 15, 2012 at 3:17 PM, Ryan Taylor <<a href="mailto:ryta1203@gmail.com">ryta1203@gmail.com</a>> wrote:<br>
> So there are some #define (defined outside the function scope) that use<br>
> it_tab that are used inside the function, is this why it is promoting it to<br>
> a global?<br>
<br>
</div>Macros shouldn't matter. Please give a complete testcase and steps to<br>
reproduce.  And please don't top-post.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Eli<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> On Wed, Aug 15, 2012 at 2:57 PM, Ryan Taylor <<a href="mailto:ryta1203@gmail.com">ryta1203@gmail.com</a>> wrote:<br>
>><br>
>> #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),<br>
>> r(.......), r(.......) ....... };<br>
>><br>
>> All of this is done inside the function I want the alloc in. The variable<br>
>> is not declared/defined/used anywhere else.<br>
>><br>
>><br>
>><br>
>><br>
>> On Wed, Aug 15, 2012 at 12:00 PM, Eli Friedman <<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> On Wed, Aug 15, 2012 at 11:40 AM, Ryan Taylor <<a href="mailto:ryta1203@gmail.com">ryta1203@gmail.com</a>> wrote:<br>
>>> > Eli, thanks for responding, unfortunately, this did not resolve my<br>
>>> > issue.<br>
>>> > It's a locally allocated array in the C code, but I'm not seeing any<br>
>>> > alloca<br>
>>> > in the IR just geps from the variable, which is never setup.<br>
>>><br>
>>> 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>
>>><br>
>>> -Eli<br>
>><br>
>><br>
><br>
</div></div></blockquote></div><br>#define other_def(x, tab, vf, rf, c)     (x ^ tab[0][x ^ c0 ^ vf ^ rf ^ c)<br>#define my_def(y,x,k,c)      defs(y,c) = (k}[c] ^ other_def(x, it_tab, inv_var, rf1, c)<br>void my_func() {<br>
     #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><br>You prefer bottom posting? Ok.<br>