Same as D60846 but with a fix for the problem encountered there which was a missing context adjustment in the handling of PHI nodes.
Thx, will do.
I thought so too, run it, and caused the assert to trigger. The last case has two ifs nested. That is already a way out of the first case, might be more.
I don't think we want to look at dominance of constants (for now) so I just return false. There is actually something we could do here, but hat is a different story.
I don't think so, and unfortunately !isa<ConstantPointerNull> doesn't work either (but that would be closer). I was hoping that "easy" constants don't make it here and hard ones would need us to inspect the surrounding (and are unlikely anyway, e.g., globals with weak linkage)