Preserving LCSSA of IR should be responsibility of transform passes. We should not try to
keep SCEV in LCSSA form because because of this we can lose some transform opportunitites.
LCSSA form is a property of the IR. As we do not change the IR here, there is no way we could destroy the LCSSA form of the underlying IR. If transformations use the extra info to destroy LCSSA form, they should be fixed.
LGTM, but please wait a bit with committing, in case the other reviewers have additional comments or I missed something.
This comment is obsolete now.
not really related to this patch, but it is not really clear what gets checked here and elsewhere. I think it would be great if we could add a clear test case where this change is beneficial.
I'm okay with the direction, but I'm also worried that this breaks some subtle invariant between SCEV and SCEVExpander. Have you tried bootstrapping clang with this change to see if that shakes out any issues?
My fuzz testing has detected LCSSA breaches. My conviction is that it's a right way to go, and the failures should be fixed where they are dont, but we can't merge it before the bugs are fixed there.