This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ping: PR tree-opt/33615 [1/2] Hoisting of throwing expression for -fnon-call-exceptions


> This didn't draw any comment from maintainers.  Andrew commented that it
> might be a good idea to set TREE_SIDE_EFFECTS for things that can throw,
> but I don't know whether that'd be easier to maintain than the new
> (function) predicate suggested in the covering patch.  Either way,
> I hope the patch as-is is strict progress.

the patch is OK, but see the notes below.

> Index: gcc/tree-ssa-loop-im.c
> ===================================================================
> --- gcc/tree-ssa-loop-im.c      2007-10-01 23:23:16.000000000 +0100
> +++ gcc/tree-ssa-loop-im.c      2007-10-01 23:39:36.000000000 +0100
> @@ -260,7 +260,8 @@ movement_possibility (tree stmt)
>    rhs = GIMPLE_STMT_OPERAND (stmt, 1);
> -  if (TREE_SIDE_EFFECTS (rhs))
> +  if (TREE_SIDE_EFFECTS (rhs)
> +      || tree_could_throw_p (rhs))
>      return MOVE_IMPOSSIBLE;
>    if (TREE_CODE (lhs) != SSA_NAME

The check for

  if (stmt_ends_bb_p (stmt))

was supposed to prevent this optimization for expressions throwing
exceptions.  However, we do not create edges to exit for exceptions that
are not caught locally; which seems somewhat wrong, certainly this
can cause problems also for other code hoisting optimizations.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]