[Bug tree-optimization/90037] [9 Regression] -Wnull-dereference false positive after r269302
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 17 07:48:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90037
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jeffrey A. Law from comment #8)
> 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.
As a middle-ground you can now run non-iterating value-numbering on a
SEME region. We are already doing that for unrolled loop bodies,
if-converted loop bodies and loop header copies, exactly to (mostly) get
local constant propagation & simplifications done. IMHO the copied
paths jump threading creates are a perfect candidate for this treatment
as well. See for example tree-ssa-loop-ch.c where it calls do_rpo_vn
(obviously VN needs up-to-date SSA so the VN is delayed until after all
loop-header copying is done and we remember the SEME regions to VN).
More information about the Gcc-bugs
mailing list