As simple as <div><br></div><div>void foo (int n, double *p, int *q)</div><div>{</div><div>   for (int i = 0; i < n; i++)</div><div>     *p += *q;</div><div>}</div><div><br></div><div>clang -O2 -fstrict-aliasing -emit-llvm -o foo.bc -c foo.c</div>
<div>llc -enable-tbaa -O2 -filetype=asm -o foo.s foo.bc</div><div><br></div><div>Memory accesses remain in the loop.</div><div><br></div><div>The following works fine:</div><div><br></div><div>void foo(int n, double *restrict p, int * restrict *q)</div>
<div>{ </div><div>  ...<br>}</div><div><br></div><div>By the way, Is there a performance category in the llvm bug database?</div><div><br></div><div>Thanks,</div><div><br></div><div>David<br><br><div class="gmail_quote">On Thu, Oct 28, 2010 at 5:59 PM, Dan Gohman <span dir="ltr"><<a href="mailto:gohman@apple.com">gohman@apple.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"><br>
On Oct 28, 2010, at 2:43 PM, Xinliang David Li wrote:<br>
<br>
><br>
><br>
> 2010/10/27 Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>><br>
> 2010/10/27 Xinliang David Li <<a href="mailto:xinliangli@gmail.com">xinliangli@gmail.com</a>>:<br>
> > Thanks. Just built clang and saw the meta data and annotations on the memory<br>
> > accesses --  is any opt pass consuming the information?<br>
><br>
> The tests in test/Analysis/TypeBasedAliasAnalysis suggest that at<br>
> least licm is using it. Also note that<br>
> lib/Analysis/TypeBasedAliasAnalysis.cpp defines as enable-tbaa option<br>
> that is off by default.<br>
<br>
</div>LICM, GVN, and DSE are the major consumers right now. That said, the<br>
current TBAA implementation is not very advanced yet.<br>
<div class="im"><br>
> I tried the option -- no much differences in the generated code.<br>
<br>
</div>Can you give an example of code you'd expect to be optimized which isn't?<br>
<font color="#888888"><br>
Dan<br>
<br>
</font></blockquote></div><br></div>