Hi, When I use "-loop-vectorize" to vectorize a loop as below: //===================================void bar(float *A, float* B, float K, int start, int end) { for (int i = start; i < end; ++i) A[i] *= B[i] + K; } //=================================== First, I use "*clang -O0 -emit-llvm -S bar.c -o bar.l*" to emit the .l file. Then I use "*opt -loop-vectorize -S bar.l -o bar.v.l*". Unfortunately, the vectorization don't work. But I use "*opt -O3 -loop-vectorize -S bar.l -o bar.v.l*" and it works. My question is: What the information needed by "*-loop-vectorize*" the "*-O3*" provides? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130702/61e5dadf/attachment.html>
Hi maxs, On 02/07/13 09:49, maxs wrote:> Hi, > When I use "-loop-vectorize" to vectorize a loop as below: > //===================================> void bar(float *A, float* B, float K, int start, int end) { > for (int i = start; i < end; ++i) > A[i] *= B[i] + K; > } > //===================================> First, I use "*clang -O0 -emit-llvm -S bar.c -o bar.l*" to emit the .l file. > Then I use "*opt -loop-vectorize -S bar.l -o bar.v.l*". Unfortunately, the > vectorization don't work. But I use "*opt -O3 -loop-vectorize -S bar.l -o > bar.v.l*" and it works. > My question is: What the information needed by "*-loop-vectorize*" the > "*-O3*" provides? Thanks.all of the advanced LLVM optimizations assume that the IR has already been cleaned up already by the less advanced optimizers. Try running something like -sroa -instcombine -simplifycfg first. Ciao, Duncan.
On 2 July 2013 12:00, Duncan Sands <baldrick at free.fr> wrote:> all of the advanced LLVM optimizations assume that the IR has already been > cleaned up already by the less advanced optimizers. Try running something > like -sroa -instcombine -simplifycfg first. >There could be a warning on more advanced optimizations if the pre-requisites haven't run (as per individual call). And maybe a way to force the dependencies to run regardless of the On level. Not sure how this dependency system would be constructed, though. --renato -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130702/72abcaff/attachment.html>