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.
Details
Diff Detail
Event Timeline
lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
5346–5347 | Basically, I guess that we could just have deleted this check for same effect. Is there a reason to keep it? What's bad about breaking LCSSA in SCEV? |
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.
lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
5342 | This comment is obsolete now. | |
test/Transforms/LoopStrengthReduce/funclet.ll | ||
48 | 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?
I'll run some extensive testing to see if it's breaking something. If yes, we have bugs to fix ahead.
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.
This comment is obsolete now.