On Thu, 9 Jun 2011, Richard Guenther wrote:

> 
> This is a complementary fix for the leslie3d problem.  For functions
> without a regular exit (for example one that exits with exit (0))
> we do not apply noreturn predictors.   The following patch notices
> that edges to noreturn calls are still unlikely if they have
> exactly one predecessor and is not fallthru.  In the leslie3d
> case this avoids predicting the edges to STOP but still correctly
> predicts the edges to the exceptional noreturn functions.
> 
> Bootstrap and regtest running on x86_64-unknown-linux-gnu, ok for trunk?

It regresses

FAIL: gcc.target/i386/umod-3.c scan-assembler-times divb 1

Richard.

> Thanks,
> Richard.
> 
> 2011-06-09  Richard Guenther  <rguent...@suse.de>
> 
>       * predict.c (tree_bb_level_predictions): For functions with
>       no regular exit still predict the edge to a block with a noreturn
>       function as not taken if it is not a fallthru edge.
> 
> Index: gcc/predict.c
> ===================================================================
> --- gcc/predict.c     (revision 174746)
> +++ gcc/predict.c     (working copy)
> @@ -1613,10 +1613,18 @@ tree_bb_level_predictions (void)
>  
>         if (is_gimple_call (stmt))
>           {
> -           if ((gimple_call_flags (stmt) & ECF_NORETURN)
> -               && has_return_edges)
> -             predict_paths_leading_to (bb, PRED_NORETURN,
> -                                       NOT_TAKEN);
> +           if ((gimple_call_flags (stmt) & ECF_NORETURN))
> +             {
> +               if (has_return_edges)
> +                 predict_paths_leading_to (bb, PRED_NORETURN,
> +                                           NOT_TAKEN);
> +               else if (single_pred_p (bb))
> +                 {
> +                   edge e = single_pred_edge (bb);
> +                   if (!(e->flags & EDGE_FALLTHRU))
> +                     predict_edge_def (e, PRED_NORETURN, NOT_TAKEN);
> +                 }
> +             }
>             decl = gimple_call_fndecl (stmt);
>             if (decl
>                 && lookup_attribute ("cold",
> 
> 

-- 
Richard Guenther <rguent...@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

Reply via email to