[PATCH] D15412: [SCEV][LAA] Add no overflow SCEV predicates and use use them to improve strided pointer detection

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 18:17:11 PST 2016


anemet added inline comments.

================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:812
@@ -811,3 +811,3 @@
         isa<ConstantInt>(OBO->getOperand(1))) {
-      auto *OpScev = SE->getSCEV(OBO->getOperand(0));
 
----------------
sbaranga wrote:
> I think that's already covered by the current change, because isStridedPtr will add the predicates if needed (and I think this is only called from isStridedPtr).
> 
> This should be better because isStridedPtr might return true even if isNoWrapAddRec returns false (for example in the case of unit strided pointers), and we try to only add predicates when needed.
> 
> If we ever end up calling isNoWrapAddRec from somewhere else than isStridedPtr, it would be a good idea to allow coercing here as well.
OK, that's possible, quite a few things are happening here implicitly.  But then please add a test for it.  I.e. gep with inbounds but the index not marked with nowrap.

================
Comment at: test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll:99
@@ +98,3 @@
+;     (zext i32 {(2 * (trunc i64 %N to i32)),+,-2}<%for.body> to i64)
+; We have added the nusw flag to turn this expression into i64 {zext i32 (2 * (trunc i64 %N to i32)) to i64,+,-2}<%for.body>
+
----------------
Long line, a few more further down.


http://reviews.llvm.org/D15412





More information about the llvm-commits mailing list