This is effectively a rework of c821ef451. That change had a major problem in that it contradicted our long standing dereferenceability implementation and turned LICM into an unsound transform. On the other hand, some of the wording clarifications were helpful. So, instead of a whole sale revert, I'm posting a potential alternative.
The core notions here are: 1) separate dereferenceability and object lifetime (in the marker intrinsic sense), and 2) unify handling for all memory object types.
If you read the existing StackColoring.cpp implementation, the degenerate slot section is describing something close to the proposed split here.
I added parties I know to be interested in this area as reviewers. I would appreciate if one of you would pick up this patch and drive it. I don't actually care about the lifetime markers at all. I'm simply posting this to try and drive the discussion into a productive direction.
I think this dereferenceability issue is more related to stack-allocated objects than heap/global objects. I couldn't write a program/find an existing optimization that has the dereferenceability issue with heap/global objects. Do you have any?
If it is, what do you think about changing this paragraph instead of the above paragraph to say everything that should be addressed? This paragraph is a good place to talk about stack thingy.