On Wed, Apr 12, 2023 at 1:52 AM Andrew MacLeod <amacl...@redhat.com> wrote: > > This is a carry over from PR 108139. > > When we have a PHI node which has 2 arguments and one is undefined, we > create an equivalence between the LHS and the non-undefined PHI > argument. THis allows us to perform certain optimizations. > > The problem is, when we are evaluating range-on-entry in the cache, its > depends on where that equivalence is made, from where we have no context. > > a_3 = <b_2 (3), c_3 (4)> > > if c_3 is undefined, then a_3 is equivalent to b_2... but b_2 is not > equivalence to a_3 everywhere.. its a one way thing. > > 108139 fixed this by not evaluating any equivalences if the equivalence > was the LHS. > > What it missed, was it possible we are calculating the range of a_3. > b_2 is not defined in a phi node, so it happily used the equivalence. > This PR demonstrates that we can't always use that equivlence either > without more context. There can be places in the IL where a_3 is used, > but b_2 has moved to a new value within a loop.
I think that's only possible when b_2 flows in via a backedge (from BB3). So isn't this all about backedges? Indeed creating equivalences across backedges is futile with SSA. I think ranger requires dominators, so to have the above scenario - a_3 used after the b_2 definition - requires BB3 to be dominated by the a_3 definition which is what you could check. > > So we can't do this if either NAME or the equivalence is equal via a PHI > node with an undefined argument. > > Unfortunately, this unsafe assumption is why PR 101912 is fixed. > Fixing this issue properly is going to cause that to reopen as it is > unsafe. (That PR is a false uninitialized warning issue, rather than an > wrong-code issue) > > This bootstraps on x86_64-pc-linux-gnu with that single regression, > which I have XFAILed for now. OK for trunk? Once Jakub verifies it > actually fixes the execution problem. we have no executable test . yet. > > Andrew > > >