[PATCH] D88806: [SCEV] Model inttoptr and ptrtoint casts not as unknown, but as zext/trunc/self of unknown

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 00:54:08 PDT 2020


lebedev.ri added a comment.

In D88806#2310959 <https://reviews.llvm.org/D88806#2310959>, @efriedma wrote:

> Using getUnknown on a value that SCEV would normally be able to reason about has weird side-effects:
> unrelated uses of the value will also pick up the Unknown.

Oh, that is a very good point..

> Not sure what all the implications of that are off the top of my head, but it's hard to reason about.



> Also, treating two distinct inttoptr instructions with the same operand as if they're equivalent is a known source of unsoundness; I don't want to expand that.

Hm, that sounds weird. Any chance for an example?
Then i'm guessing we can't allow this in any form even if `unknown` is a `load`?

> Given that, I don't think this is the right way to approach the issue.
> I prefer the approach from https://bugs.llvm.org/show_bug.cgi?id=46786#c20 .
> That would allow optimizing the given examples,
> I think: in contexts where we don't care about the derivation of a pointer,
> we can look through ptrtoint/inttoptr operations.
> (I don't think I'll have time to implement that in the near future, though.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88806



More information about the llvm-commits mailing list