[PATCH] D104498: [WIP][ScalarEvolution] Strictly enforce pointer/int type rules.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 22 22:21:17 PDT 2021


efriedma added a comment.

In D104498#2835013 <https://reviews.llvm.org/D104498#2835013>, @reames wrote:

> Style wise, I really don't see the value in the getPointerDiff api.  Most of the places which need to compute a diff work with both pointers and integers.  I'd rather just have getMinusSCEV documented as being able to return CouldNotCompute when both operands are pointers.

Do you mean getMinusSCEV would never generate PtrToInt expressions, or just that it wouldn't generate them for non-integral pointers?  I mean, we could make it work either way, but it would probably be easier to support non-integral pointers if all pointers behave the same way.

> I also want to preserve the existing "it's an error to query information about CouldNotCompute" structure.  Given this, callers should bail before calling isKnownX and friends.  We should strengthen asserts on access.  A couple of the stack traces got surprisingly far into SCEV before we hit an access assert.

Makes sense.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104498



More information about the llvm-commits mailing list