On Tue, Nov 13, 2018 at 10:04:03AM +0100, Richard Biener wrote:
> On Tue, 13 Nov 2018, Jakub Jelinek wrote:
> 
> > Hi!
> > 
> > During analysis, we correctly ignore debug stmt uses, but if we don't
> > release the ssa name we stopped using, the debug stmts uses are left in the
> > IL.  The reset_debug_uses call is needed because the code modifies the
> > division stmt in place.  Perhaps better would be not to do that, i.e.
> > create a new division and gsi_replace it, then just the release_ssa_name
> > would be enough and the generic code could add e.g. the 1.0 / _1 replacement
> > for the debug stmt?
> 
> Yeah, that's how we usually deal with this.  I hope the re-use of the
> LHS is with the same value?

The lhs isn't reused.
      gimple_assign_set_lhs (stmt, sqr_ssa_name);
      gimple_assign_set_rhs2 (stmt, a);
changes both lhs and rhs2 to some other operand.  Without the
reset_debug_uses and not actually reusing the stmt we get wrong debug
info (1.0 / a), i.e. with the new rhs2, rather than old.

> >  Though, in this particular case the sqrt call is
> > optimized away, so it wouldn't make a difference.
> > 
> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk, or
> > should I do the gimple_build_assign + gsi_replace change?
> 
> I think that would be cleaner.

Ok, will do.  Thanks.

        Jakub

Reply via email to