Avoid unnnecesary copying of ipa-prop's expressions
Richard Biener
rguenther@suse.de
Mon Feb 10 08:52:00 GMT 2014
On Fri, 7 Feb 2014, Jan Hubicka wrote:
> > On Thu, 6 Feb 2014, Jan Hubicka wrote:
> >
> > > Hi,
> > > at WPA we currently read trees accessed by jump functions and then copy them
> > > to remove location that is already known to be UNKNOWN and then keep copying
> > > them for every inline clone introduced (and there are many for firefox)
> > >
> > > This patch makes us to copy only when expression really has an location in it.
> > >
> > > Bootstrapped/regtested x86_64-linux, OK?
> >
> > Hmm, I think you either can use just
> >
> > if (EXPR_P (expr))
> > walk_tree (&expr, prune_expr_location, NULL, NULL);
> >
> > or you miss unsharing and create invalid shared trees when
> > the expr does not contain locations.
> >
> > I fear it's the latter, given how ipa_set_jf_* is used.
>
> Well, ipa-prop analysis takes random operands from GIMPLE bodies and
> stores them into jump function. Then it streams in/out, propagates and
> eventually uses them as a replacements for bodies.
>
> We use unshare_without_location primarily to prevent LTO from need to stream
> stale BLOCK expressions and to avoid inserting wrong blocks into clones
> http://gcc.gnu.org/ml/gcc-patches/2012-12/msg01176.html
> http://gcc.gnu.org/ml/gcc-patches/2012-09/msg01343.html
I know.
> Calling prine_expr_location would kill locations in the original
> function body they are taken from. For constant JF, they are IP
Ah, true.
> invariants, so I do not think they need unsharing. THe arithmetic is
> never inserted back to GIMPLE code.
Well. Our sharing indeed allows is_gimple_min_invariant nodes to
be shared (tree-cfg.c:tree_node_can_be_shared).
So your original patch looks ok.
Thanks,
Richard.
> I can also just add no_unshare parameter to jump functions to avoid the
> unsharing during stream-in, possibly.
More information about the Gcc-patches
mailing list