https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90037
Jeffrey A. Law <law at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 Component|middle-end |tree-optimization --- Comment #8 from Jeffrey A. Law <law at redhat dot com> --- So, if we change phionlycprop to look for other const/copy initializations that can be eliminated and run a pass between DOM and the erroneous-path isolation pass, then the false positive is eliminated (as expected). There's two things I don't like about that. First, it turns phionlycprop into a full-fledged constant propagation pass. phionlycprop is supposed to be so fast that we never really notice it. It accomplishes this by only looking at PHI nodes that are degenerates and any constants exposed by propagating way the degenerate PHI. Essentially it's just cleaning up painfully obvious cruft left by jump threading. To pick up this case we'd have to scan statements in blocks. We could restrict that to blocks where we eliminated degenerate PHI. But still. Ugh. Second, once phionlycprop is doing more work, I'm less inclined to want to add another instance of the pass. Finally, once phionlycprop is doing more work one could legitimately ask if we should just drop the code and use the lattice copy propagator. Just for fun I replaced all the phi-only cprop calls with calls into the lattice propagator (including the one I added between DOM and erroneous-path optimization). As expected that fixes the testcase too. It also happens to clean up things slightly better at an earlier point in the optimizer pipeline. I don't know if it's a good trade-off though.