[SCEV] Introduce SCEVPtrToIntExpr (PR46786)
And use it to model LLVM IR's ptrtoint cast.
As we've established by now, there are at least two reasons why we want this:
- It will allow SCEV to actually model the ptrtoint casts and their operands, instead of treating them as SCEVUnknown
- It should help with initial problem of PR46786 - this should eventually allow us to not loose pointer-ness of an expression in more cases
As discussed in PR46786, in principle,
we could just extend SCEVUnknown with a is ptrtoint cast, because ScalarEvolution::getPtrToIntExpr()
should sink the cast as far down into the expression as possible,
so in the end we should always end up with SCEVPtrToIntExpr of SCEVUnknown.
But i think that it isn't the best solution, because it doesn't really matter
from memory consumption side - there probably won't be *that* many SCEVPtrToIntExprs
for it to matter, and it allows for much better discoverability.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D89456