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: [PATCH 4/4] Do not check whether memory references accessed in every iteration trap.


Hi,

On Wed, 7 Jul 2010, Sebastian Pop wrote:

> +static bool
> +memrefs_read_or_written_unconditionally (gimple stmt,
> +					 VEC (data_reference_p, heap) *refs)
> +{
> +  struct data_reference *a, *b;
> +  unsigned int i, j;
> +  tree cond = bb_predicate (gimple_bb (stmt));
> +
> +  for (i = 0; VEC_iterate (data_reference_p, refs, i, a); i++)
> +    if (DR_STMT (a) == stmt)
> +      {
> +	for (j = 0; VEC_iterate (data_reference_p, refs, j, b); j++)

So, this is O(num-data-refs).

> +static bool
> +ifcvt_could_trap_p (gimple stmt, VEC (data_reference_p, heap) *refs)
> +{
> +  if (gimple_has_mem_ops (stmt)
> +      && ifcvt_memrefs_wont_trap (stmt, refs)
> +      && !operations_could_trap (stmt))
> +    return false;
> +
> +  return gimple_could_trap_p (stmt);

Therefore this is too.

> @@ -478,7 +630,7 @@ if_convertible_gimple_assign_stmt_p (gimple stmt)
>  
>    if (flag_loop_if_convert_memory_writes)
>      {
> -      if (gimple_could_trap_p (stmt))
> +      if (ifcvt_could_trap_p (stmt, refs))

And here you replace a O(1) with the above O(num-data-refs).  This itself 
is called on every assign statement for loops.  I think it would be much 
better to compute the trapping/non-trapping condition once for each 
data-ref and mark the associated statements in some way (we have 
pass-local flags for that for instance).


Ciao,
Michael.


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