HomePhabricator

[SCEV] Introduce SCEVPtrToIntExpr (PR46786)

Authored by lebedev.ri on Oct 29 2020, 11:12 PM.

Description

[SCEV] Introduce SCEVPtrToIntExpr (PR46786)

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.

Reviewed By: mkazantsev

Differential Revision: https://reviews.llvm.org/D89456

Details

Committed
lebedev.riOct 30 2020, 1:13 AM
Reviewer
mkazantsev
Differential Revision
D89456: [SCEV] Introduce SCEVPtrToIntExpr (PR46786)
Parents
rGfc0892c1f9a3: [mips] Implement add.ps, mul.ps and sub.ps
Branches
Unknown
Tags
Unknown