[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 08:56:10 PDT 2023


reames added a comment.

I think this is correct, but for different reasoning.

"The successive addition of the current address, interpreted as an unsigned number, and an offset, interpreted as a signed number, does not wrap the unsigned address space and remains in bounds of the allocated object. As a corollary, if the added offset is non-negative, the addition does not wrap in an unsigned sense (nuw)."

A non-negative stride is clearly and explicitly okay from the corollary.  The wording on the first part is slightly hard to follow, but I think this also disallows underflow *as integers* for negative offsets.  However, the condition is the corollary maybe hints I'm missing something here?  I *think* this is the distinction between arithmetic overflow (where a negative offset does NUW wrap), and address space overflow (where it doesn't)  I *think* the later is the semantic we're actually proving here, but the definition of IncrementWrapFlags is a bit hard to follow for me.


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

https://reviews.llvm.org/D149936



More information about the llvm-commits mailing list