Juan Manuel Martinez Caamaño
2012-Nov-07 12:35 UTC
[LLVMdev] Problem migrating from llvm 2.9 to 3.0
Hello, I'm moving a compiler pass from llvm 2.9 to 3.0, and I'm getting some strange extra store instructions when optimizing the code. For example, in the code that is in the attachments (On block *for.body111* for 2.9 and block *for.body67 *for 3.0), the number of stores goes from 1 to 10. And since the compiler pass adds some verification code before each store, this leads to some performance problems. The resulting .ll is obtained in this way: clang -O3 fir2dim.c -S -emit-llvm -o fir2dim.ll llvm-as fir2dim.ll opt -O3 fir2dim.bc > fir2dim.opt.bc llvm-dis fir2dim.opt.bc Any idea why this is happening ? Thanks, Juan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121107/844bba65/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: fir2dim.c Type: text/x-csrc Size: 1936 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121107/844bba65/attachment.c> -------------- next part -------------- A non-text attachment was scrubbed... Name: fir2dim.opt.2.9.ll Type: application/octet-stream Size: 9523 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121107/844bba65/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: fir2dim.opt.3.0.ll Type: application/octet-stream Size: 11124 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121107/844bba65/attachment-0001.obj>
Hi Juan, On 07/11/12 13:35, Juan Manuel Martinez Caamaño wrote:> Hello, I'm moving a compiler pass from llvm 2.9 to 3.0, and I'm getting some > strange extra store instructions when optimizing the code. > > For example, in the code that is in the attachments (On block *for.body111* for > 2.9 and block *for.body67 *for 3.0), the number of stores goes from 1 to 10. And > since the compiler pass adds some verification code before each store, this > leads to some performance problems. > > The resulting .ll is obtained in this way: > clang -O3 fir2dim.c -S -emit-llvm -o fir2dim.ll > llvm-as fir2dim.ll > opt -O3 fir2dim.bc > fir2dim.opt.bc > llvm-dis fir2dim.opt.bc > > Any idea why this is happening ?maybe it completely unrolled this loop: for (i = 0 ; i < 9 ; i++) { *poutput += *pcoeff++ * *(parray++ +(i / 3) * ARRAYDIM) ; } ? Ciao, Duncan.
Juan Manuel Martinez Caamaño
2012-Nov-07 18:13 UTC
[LLVMdev] Problem migrating from llvm 2.9 to 3.0
Hi Duncan, In in both versions of llvm 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. I've tried compiling on llvm 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 ? Thanks, Juan 2012/11/7 Duncan Sands <baldrick at free.fr>> Hi Juan, > > > On 07/11/12 13:35, Juan Manuel Martinez Caamaño wrote: > >> Hello, I'm moving a compiler pass from llvm 2.9 to 3.0, and I'm getting >> some >> strange extra store instructions when optimizing the code. >> >> For example, in the code that is in the attachments (On block >> *for.body111* for >> 2.9 and block *for.body67 *for 3.0), the number of stores goes from 1 to >> 10. And >> >> since the compiler pass adds some verification code before each store, >> this >> leads to some performance problems. >> >> The resulting .ll is obtained in this way: >> clang -O3 fir2dim.c -S -emit-llvm -o fir2dim.ll >> llvm-as fir2dim.ll >> opt -O3 fir2dim.bc > fir2dim.opt.bc >> llvm-dis fir2dim.opt.bc >> >> Any idea why this is happening ? >> > > maybe it completely unrolled this loop: > > > for (i = 0 ; i < 9 ; i++) { > *poutput += *pcoeff++ * *(parray++ > +(i / 3) * ARRAYDIM) ; > } > > ? > > Ciao, Duncan. > ______________________________**_________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121107/1fd8408f/attachment.html>