[PATCH] D51431: [WIP][IPSCCP] Add lattice value for != constant and propagate nonnull.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 16 14:59:28 PDT 2018


fhahn added a comment.

In https://reviews.llvm.org/D51431#1262979, @efriedma wrote:

> You're making the lattice really confusing.  Essentially, there are now two different merging rules: one is used if the caller calls mergeInValue, and a different one is used if the caller calls markNotConstant etc.  So it's not obvious what the lattice actually represents.
>
>  ----
>
> And actually, thinking about it a bit more, there's a more fundamental problem with proving a value is non-null.  Given that a value is possibly-undef, it could be null even for code dominated by a null-check. So the entire proposed transform is unsound unless you freeze the pointer.


Right, thanks Eli! I think we would have to same problem when we would use conditions to derive constant ranges. I am not sure what you mean by freezing the pointer I am afraid. In case you are at the dev meeting, is that something you would be interested to talk about briefly?

> This doesn't normally cause a problem for existing SCCP analysis because the only transform SCCP usually performs is refining an value to a specific constant.  (It also erases dead code, but that isn't really relevant here.)  Along a path where x==null is true, it's possible for x to evaluate to some non-null value. but it's still okay for SCCP to replace x with null.




https://reviews.llvm.org/D51431





More information about the llvm-commits mailing list