This is an archive of the discontinued LLVM Phabricator instance.

[LVI] Meet rules for non-null pointers
AbandonedPublic

Authored by reames on Dec 6 2016, 4:29 PM.

Details

Summary

The patch itself is fairly straight-forward, it simply extends LVI conservative meet operator to remember non-null facts when merging non-null constants.

However, the fact I had to write this is really making me question the value of pointer types in LVI as a whole. The lack of any decent meet rule basically means that pointer handling in LVI reduces to equality propagation and a dereferenceability based non-null analysis. Given GVN implements a version of the former (minus the meet of two constants case), I'm wondering whether pointers should just be removed from LVI and handled separately. I want to stew on that a bit further before actually landing this patch.

Diff Detail

Event Timeline

reames updated this revision to Diff 80501.Dec 6 2016, 4:29 PM
reames retitled this revision from to [LVI] Meet rules for non-null pointers.
reames updated this object.
reames added a subscriber: llvm-commits.
reames abandoned this revision.Dec 6 2016, 8:13 PM

This turns out to be a terrible idea as written. I realized after some reflection that I was essentially adding another state into the lattice and reused the not-constant state to represent both it's original meaning and the new state. In particular, this patch would allow a constant to fall to a non-constant before reaching overdefined. That's a new state transition not previously allowed..

The optimization power might be worth salvaging somewhere else; possibly as a null check specific analysis? I'm noticing in this code that floats, pointers, and integers get essentially disjoint results despite sharing a common infrastructure. (We never use results from one domain to influence results from another.) I'm increasingly thinking we need to split the analysis to reflect that. It might be worth sharing some code, but I'm also thinking about entirely different framings for the non-null analysis which is the primary purpose of the pointer tracking. Something to think about further...