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: [RFA] [PR tree-optimization/33562] [PATCH 1/4] Byte tracking in DSE


On Thu, Dec 15, 2016 at 06:54:43PM -0700, Jeff Law wrote:
>    unsigned cnt = 0;
> +  bitmap live_bytes = NULL;
> +  bitmap orig_live_bytes = NULL;
>  
>    *use_stmt = NULL;
>  
> +  /* REF is a memory write.  Go ahead and get its base, size, extent
> +     information and encode the bytes written into LIVE_BYTES.  We can
> +     handle any case where we have a known base and maximum size.
> +
> +     However, experimentation has shown that bit level tracking is not
> +     useful in practice, so we only track at the byte level.
> +
> +     Furthermore, experimentation has shown that 99% of the cases
> +     that require byte tracking are 64 bytes or less.  */
> +  if (valid_ao_ref_for_dse (ref)
> +      && (ref->max_size / BITS_PER_UNIT
> +	  <= PARAM_VALUE (PARAM_DSE_MAX_OBJECT_SIZE)))
> +    {
> +      live_bytes = BITMAP_ALLOC (NULL);
> +      orig_live_bytes = BITMAP_ALLOC (NULL);
> +      bitmap_set_range (live_bytes,
> +			ref->offset / BITS_PER_UNIT,
> +			ref->max_size / BITS_PER_UNIT);
> +      bitmap_copy (orig_live_bytes, live_bytes);

would it maybe make sense to use sbitmaps since the length is known to
be short, and doesn't change after allocation?

> @@ -164,7 +341,15 @@ dse_possible_dead_store_p (ao_ref *ref, gimple *stmt, gimple **use_stmt)
>  	}
>  
>        if (fail)
> -	return false;
> +	{
> +	  /* STMT might be partially dead and we may be able to reduce
> +	     how many memory locations it stores into.  */
> +	  if (live_bytes
> +	      && !bitmap_equal_p (live_bytes, orig_live_bytes)
> +	      && !gimple_clobber_p (stmt))
> +	    trim_partially_dead_store (orig_live_bytes, live_bytes, stmt);
> +	  return false;

shouldn't you free the bitmaps here?

Trev


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