This is the mail archive of the gcc-patches@gcc.gnu.org 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: [RFC] Move ehcleanup pass to before early SRA


> What you want is tree-eh.c:optimize_clobbers, right?  Can't we
> do this optimization during EH refactoring / lowering as well?

We need the SSA form for sink_clobbers.

> Also why does SRA refuse to scalarize here?

Because of the EH handler and the following predicate:

/* Disqualify LHS and RHS for scalarization if STMT must end its basic block
   in modes in which it matters, return true iff they have been disqualified.
   RHS may be NULL, in that case ignore it.  If we scalarize an aggregate in
   intra-SRA we may need to add statements after each statement.  This is not
   possible if a statement unconditionally has to end the basic block.  */
static bool
disqualify_ops_if_throwing_stmt (gimple stmt, tree lhs, tree rhs)
{
  if ((sra_mode == SRA_MODE_EARLY_INTRA || sra_mode == SRA_MODE_INTRA)
      && (stmt_can_throw_internal (stmt) || stmt_ends_bb_p (stmt)))
    {
      disqualify_base_of_expr (lhs, "LHS of a throwing stmt.");
      if (rhs)
	disqualify_base_of_expr (rhs, "RHS of a throwing stmt.");
      return true;
    }
  return false;
}

> It will end up scalarizing during regular opts as
> 
> <L1>:
>   result = decls_support.get_private (100);
>   result$i_12 = MEM[(struct decls_support__t_private *)&result];

Yes, it's scalarized during SRA but not ESRA because there is an ehcleanup 
pass in-between.  It used to be scalarized during ESRA up to 4.6.x.

> The current placement of EH cleanup is to make it catch
> all opportunities before early inlining sees the function as
> callee.  And I guess both FRE and DCE will expose quite
> some EH cleanup opportunities especially with non-call-exceptions.

Early inlining or regular inlining (I'm always slightly confused here)?

p.adb.003t.original
p.adb.004t.gimple
p.adb.005t.nested
p.adb.006t.omplower
p.adb.007t.lower
p.adb.009t.ehopt
p.adb.010t.eh
p.adb.011t.cfg
p.adb.015t.ssa
p.adb.017t.inline_param1
p.adb.018t.einline
p.adb.019t.early_optimizations
p.adb.020t.copyrename1
p.adb.021t.ccp1
p.adb.022t.forwprop1
p.adb.023t.ealias
p.adb.024t.esra
p.adb.025t.fre1
p.adb.026t.copyprop1
p.adb.027t.mergephi1
p.adb.028t.cddce1
p.adb.029t.eipa_sra
p.adb.030t.tailr1
p.adb.031t.switchconv
p.adb.032t.ehcleanup1
p.adb.033t.profile_estimate
p.adb.034t.local-pure-const1
p.adb.035t.fnsplit
p.adb.036t.release_ssa
p.adb.037t.inline_param2
p.adb.054t.copyrename2

Then we could add another ehcleanup pass before early inlining, i.e. between 
015t.ssa and 017t.inline_param1, to achieve the same goal.

-- 
Eric Botcazou


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