Hi Duncan,<div>In in both versions of <span class="" style>llvm</span> it unrolls that loop. But I don't understand why in 2.9 it uses registers for intermediate results and only one store, and in the other version, it performs stores for every intermediate result.</div>

<div><br></div><div>I've tried compiling on <span class="" style>llvm</span> 3.0 using exactly the same optimizations, in the same order as in 2.9 and I still get the same problem. Maybe a optimization has changed from 2.9 to 3.0 ?</div>

<div><br></div><div>Thanks,</div><div><br></div><div>Juan</div><div class="gmail_extra"><br><br><div class="gmail_quote">2012/11/7 Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Juan,<div class="im"><br>
<br>
On 07/11/12 13:35, Juan Manuel Martinez Caamaño wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Hello, I'm moving a compiler pass from llvm 2.9 to 3.0, and I'm getting some<br>
strange extra store instructions when optimizing the code.<br>
<br></div>
For example, in the code that is in the attachments (On block *for.body111* for<br>
2.9 and block *for.body67 *for 3.0), the number of stores goes from 1 to 10. And<div class="im"><br>
since the compiler pass adds some verification code before each store, this<br>
leads to some performance problems.<br>
<br>
The resulting .ll is obtained in this way:<br>
clang -O3 fir2dim.c -S -emit-llvm -o fir2dim.ll<br>
llvm-as fir2dim.ll<br>
opt -O3 fir2dim.bc > fir2dim.opt.bc<br>
llvm-dis fir2dim.opt.bc<br>
<br>
Any idea why this is happening ?<br>
</div></blockquote>
<br>
maybe it completely unrolled this loop:<br>
<br>
<br>
                                for (i = 0 ; i < 9 ; i++) {<br>
                                        *poutput += *pcoeff++ * *(parray++ +(i / 3) * ARRAYDIM) ;<br>
                                }<br>
<br>
?<br>
<br>
Ciao, Duncan.<br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>