[PATCH] D49516: [LoadStoreVectorizer] Use getMinusScev() to compute the distance between two pointers.

Farhana Aleen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 21 16:19:30 PDT 2018


FarhanaAleen added inline comments.


================
Comment at: llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:351
+
   // Sometimes even this doesn't work, because SCEV can't always see through
   // patterns that look like (gep (ext (add (shl X, C1), C2))). Try checking
----------------
FarhanaAleen wrote:
> reames wrote:
> > This block may also be subsumed by the subtract.  If not, this would make a good bug against SCEV because it should be able to handle most any reasonable case here.
> No, this block is not subsumed by the subtract. 
> 
> Currently, SCEV does not handle distribution around zext/sext. I am working on a patch that extends SCEV to handle this and remove this routine entirely from LoadStoreVectorizer.
In order to get rid of this block, a fundamental problem of SCEV needs to be solved which is proving a value "V" is not a poison value. Currently, this proving is supported only when V is in the header of a loop L where L repeatedly contains V. When V is not inside a loop, SCEV conservatively considers it as a poison value. Since SCEV can guarantee that V will not overflow, it conservatively drops the nsw/nuw flag. 

func(%base) {
B1:
   %add1 = add i32 nsw 1, %base
   ..
}

In the above example, there no way to guarantee that the %add1 will not overflow other than relying on the IR flag.  But SCEV does not allow mapping back to the original instruction (), therefore corresponding scev expr will not contain nsw/nuw flag. This block of code is taking advantage of the IR to extract the flag information. 


Repository:
  rL LLVM

https://reviews.llvm.org/D49516





More information about the llvm-commits mailing list