On 31 October 2013 08:01, Frank Winter <fwinter at jlab.org> wrote:> With current trunk I tried the following on the above example: > > clang++ -emit-llvm -S loop_minimal.cc -std=c++11 > opt -O3 -vectorize-slp -S loop_minimal.ll > opt -O3 -loop-vectorize -S loop_minimal.ll > opt -O3 -bb-vectorize -S loop_minimal.ll > > All optimization passes miss the opportunity. It seems the SCEV AA pass doesn't understand modulo arithmetic. > >Hi Frank, IIRC, opt -O3 will already pass all three, so you don't have to add it to the command line. How can the SCEV AA pass be extended to handle this type of arithmetic?> >I'm not an SCEV expert, so it might be possible that it does understand, but the loop vectorizer is not understanding the evolution info, or whatever. What I recommend is to step through the loop vectorizer (canVectorize) and see what the SCEV returns to the vectorizer. If the info is there, but not accounted for, it's a vectorizer bug. If the SCEV gets lost, than you need to add it into the SCEV logic. cheers, --renato -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131031/0427103a/attachment.html>
----- Original Message -----> > On 31 October 2013 08:01, Frank Winter < fwinter at jlab.org > wrote: > > > > > > > With current trunk I tried the following on the above example: > > clang++ -emit-llvm -S loop_minimal.cc -std=c++11 > opt -O3 -vectorize-slp -S loop_minimal.ll > opt -O3 -loop-vectorize -S loop_minimal.ll > opt -O3 -bb-vectorize -S loop_minimal.ll > > All optimization passes miss the opportunity. It seems the SCEV AA > pass doesn't understand modulo arithmetic. > > > Hi Frank, > > > IIRC, opt -O3 will already pass all three, so you don't have to add > it to the command line.-O3 will not automatically add the -bb-vectorize in clang or in opt. From Clang, SLP and loop vectorization are enabled from -O3. From opt, I don't believe that this is true (although we should probably fix that).> > > > > > > > How can the SCEV AA pass be extended to handle this type of > arithmetic?To be clear, the loop vectorizer does not use the SCEV AA analysis to do dependence checking. It uses SCEV in its own internal memory dependence checking class. -Hal> > > I'm not an SCEV expert, so it might be possible that it does > understand, but the loop vectorizer is not understanding the > evolution info, or whatever. > > > What I recommend is to step through the loop vectorizer > (canVectorize) and see what the SCEV returns to the vectorizer. If > the info is there, but not accounted for, it's a vectorizer bug. If > the SCEV gets lost, than you need to add it into the SCEV logic. > > > cheers, > --renato-- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory
On 31 October 2013 09:42, Hal Finkel <hfinkel at anl.gov> wrote:> > How can the SCEV AA pass be extended to handle this type of > > arithmetic? > > To be clear, the loop vectorizer does not use the SCEV AA analysis to do > dependence checking. It uses SCEV in its own internal memory dependence > checking class. >Hi Hal, Thanks for the clarification! I have to say I haven't dug that deeply in the AA recently, I assumed it was using it. Would it make sense to use it, given that the induction could be a complex expression? cheers, --renato -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131031/95be0cad/attachment.html>
Apparently Analagous Threads
- [LLVMdev] loop vectorizer misses opportunity, exploit
- [LLVMdev] loop vectorizer misses opportunity, exploit
- [LLVMdev] loop vectorizer misses opportunity, exploit
- [LLVMdev] loop vectorizer misses opportunity, exploit
- [LLVMdev] loop vectorizer misses opportunity, exploit