On Tue, May 18, 2021 at 1:23 AM Andrew MacLeod via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > The code in PR 100512 triggers an interaction between ranger and the > propagation engine related to undefined values. > > I put the detailed analysis in the PR, but it boils down to the early > VRP pass has concluded that something is a constant and can be replaced, > and removes the definition expecting the constant to be propagated > everywhere. > > > If the code is in an undefined region that the CFG is going to remove, > we can find impossible situations,a nd ranger then changes that value ot > UNDEFINED.. because, well, it is. But then the propagation engine > panics because it doesnt have a constant any more, so odesnt replace it, > and now we have a used but not defined value. > > Once we get to a globally constant range where further refinements can > only end up in an UNDEFINED state, stop further evaluating the range. > This is typically in places which are about to be removed by CFG cleanup > anyway, and it will make the propagation engine happy with no surprises.
Yeah, the propagation engine and EVRP as I know it relies on not visiting "unexecutable" (as figured by anaysis) paths in the CFG and thus considering edges coming from such regions not contributing conditions/values/etc. that would cause such "undefinedness" to appear. Not sure how it works with ranger, maybe that can as well get a mode where it does only traverse EDGE_EXECUTABLE edges. Might be a bit difficult since IIRC it works with SSA edges and not CFG edges. > Bootstraps on x86_64-pc-linux-gnu with no regressions, and fixes the PR. So that means the lattice isn't an optimistic lattice, right? EVRPs wasn't optimistic either, but VRPs is/was. Whatever this means in this context ;) Richard. > Pushed. > > Andrew > > >