This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Introduce deep unsharing
> Wouldn't it be simpler (or would it be possible at all) to always
> unshare the SAVE_EXPR operand in gimplify_save_expr
> if !SAVE_EXPR_RESOLVED_P? That would avoid the pointer-map
> and I'd say we can do so unconditionally.
I forgot about something: statement expressions. C and Java generate them,
and Ada is about to do it to support a new FE node N_Expression_With_Actions.
They are wrapped up in a SAVE_EXPR and you cannot call unshare_expr on them,
this will abort. That's why there is a specific line in my patch for them.
Moreover, they are generally referenced only once so blindly unsharing them
will be a sheer waste of resources.
I'd also be able to experiment with TARGET_EXPR for Ada in the future so I'd
prefer that it be addressed in the patch as well.
So, in the end, I think my patch is the best compromise: it only affects Ada
(so I won't have to face the libjava monster in case something goes awry :-),
it doesn't unshare unnecessarily for the most common cases, it doesn't add
unsharing in the middle of gimplication and it already handles TARGET_EXPR.
--
Eric Botcazou