Teach SCCP to create notconstant lattice values from inequality comparisons and nonnull metadata, and update getConstant() to make use of them. Additionally isOverdefined() needs to be changed to consider notconstant an overdefined value.
Okay, taking this off the queue for now. It should be noted though that we already perform this optimization in quite a few places (inequalities are recognized by LVI and thus optimized in JT/CVP and nonnull inequalities in particular are recognized by ValueTracking, and as such optimized all over the place.)
Restrict patch to MayIncludeUndef=false, which is metadata and assumes, but not comparisons. This puts the basic machinery in place, and will get fully enabled once the MayIncludeUndef flag for branches gets flipped.
I think we could also try to model dereferenced pointers as non-null with a new predicate. In particular, we could create ssa_copys for dereferenced pointers, attach a predicate and rename all dominated uses. Not sure how useful/expensive that would be though. Also, ideally we would want to rename all pointers to the same underlying object.