[autovect] [patch] Make store motion use alias oracle

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Wed Mar 14 09:31:00 GMT 2007


Hello,

> Attached is the patch that fix the problem exposed in tree-if-conv.c as
> was discussed previously.  It was bootstrap and tested on ppc together
> with the lim patch.
> 
> OK for autovect?

assuming that you do the required testing, this is OK for mainline as
well.

Zdenek

> Thanks,
> Revital
> 
> (See attached file: ifcvt_fix_patch_14_3.txt)
> 
> 2007-03-14  Revital Eres  <eres@il.ibm.com>
> 
>         * tree-if-conv.c (may_have_side_effect_p): New
>           function to check if stmt is if-convertible.
>           (if_convertible_gimple_modify_stmt_p): Call it.

> Index: tree-if-conv.c
> ===================================================================
> --- tree-if-conv.c	(revision 122880)
> +++ tree-if-conv.c	(working copy)
> @@ -334,9 +334,38 @@
>    return true;
>  }
>  
> +/* Return true if STMT may have certain side effects
> +   and thus ifcvt can not be applied.  Otherwise return false.  */
> +static bool
> +may_have_side_effect_p (tree stmt)
> +{
> +  tree lhs, rhs;
> +
> +  if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
> +    return true;
> +
> +  if (stmt_ends_bb_p (stmt))
> +    return true;
> +
> +  if (stmt_ann (stmt)->has_volatile_ops)
> +    return true;
> +
> +  lhs = GIMPLE_STMT_OPERAND (stmt, 0);
> +  if (TREE_CODE (lhs) == SSA_NAME
> +      && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
> +    return true;
> +
> +  rhs = GIMPLE_STMT_OPERAND (stmt, 1);
> +
> +  if (TREE_SIDE_EFFECTS (rhs))
> +    return true;
> +    
> +  return false;
> +}
> +
>  /* Return true, if M_EXPR is if-convertible.
>     GIMPLE_MODIFY_STMT is not if-convertible if,
> -   - It is not movable.
> +   - It may have certain side effects.
>     - It could trap.
>     - LHS is not var decl.
>    GIMPLE_MODIFY_STMT is part of block BB, which is inside loop LOOP.
> @@ -352,11 +381,12 @@
>        print_generic_stmt (dump_file, m_expr, TDF_SLIM);
>      }
>  
> -  /* Be conservative and do not handle immovable expressions.  */
> -  if (movement_possibility (m_expr) == MOVE_IMPOSSIBLE)
> +  /* Be conservative and do not handle expressions with
> +     certain side effects.  */
> +  if (may_have_side_effect_p (m_expr))
>      {
>        if (dump_file && (dump_flags & TDF_DETAILS))
> -	fprintf (dump_file, "stmt is movable. Don't take risk\n");
> +	fprintf (dump_file, "stmt with side effects. Don't take risk\n");
>        return false;
>      }
>  



More information about the Gcc-patches mailing list