And use it to model LLVM IR's ptrtoint cast.
This is essentially an alternative to D88806, but with no chance for
all the problems it caused due to having the cast as implicit there.
(see rG7ee6c402474a2f5fd21c403e7529f97f6362fdb3)
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.
This probably needs some more tests.
I'm not adding any rewrites right in this patch.
clang-format: please reformat the code
16 diff lines are omitted. See full path.