[PATCH] D149936: [LAA] Don't require stride one for inbounds GEP

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 10:44:26 PDT 2023


reames added a comment.

In D149936#4327222 <https://reviews.llvm.org/D149936#4327222>, @nikic wrote:

> @reames What LangRef is describing there is basically "nusw" in SCEV terms, which is I believe is also the property LAA is interested in (or at least, that's what it adds to PSE). What LangRef is trying to emphasize here is that inbounds is **not** nsw, it is nusw, which reduces to nuw for non-negative offsets.

I think I agree.  If so, your patch here is definitely sound.

Might be good to update the SCEV docs or the inbounds docs to explicitly link the two definitions.  Would make this type of discussion much easier going forward.

We should also maybe consider singing "nusw" into base SCEV wrap enum so we can be explicit about the difference.  SCEV should conceptually be able to prove it on any inbounds gep which is known to reach a UB-if-poison use.  (The use case here doesn't have to prove the existence of the use.)  That may (or may not) actually be worth doing.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149936/new/

https://reviews.llvm.org/D149936



More information about the llvm-commits mailing list