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, PR bootstrap/41395] Make IPA-SRA ignore stdarg va_lists


On Thu, 1 Oct 2009, Martin Jambor wrote:

> Hi,
> 
> according to Uros, the following patch enables bootstrap with IPA-SRA
> on alpha.  I have also bootstrapped and tested it on x86_64-linux and
> ia64-linux (with IPA-SRA enabled at -O2).
> 
> OK for trunk?

Ok.

Thanks,
Richard.

> Thanks,
> 
> Martin
> 
> 
> 2009-10-01  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR bootstrap/41395
> 	* tree-sra.c (is_va_list_type): New function.
> 	(find_var_candidates): Call is_va_list_type.
> 	(find_param_candidates): Check that the type or the type pointed
> 	to are not va_list types.
> 
> 
> Index: mine/gcc/tree-sra.c
> ===================================================================
> --- mine.orig/gcc/tree-sra.c
> +++ mine/gcc/tree-sra.c
> @@ -1323,6 +1323,14 @@ build_ref_for_offset (tree *expr, tree t
>    return build_ref_for_offset_1 (expr, type, offset, exp_type);
>  }
>  
> +/* Return true iff TYPE is stdarg va_list type.  */
> +
> +static inline bool
> +is_va_list_type (tree type)
> +{
> +  return TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (va_list_type_node);
> +}
> +
>  /* The very first phase of intraprocedural SRA.  It marks in candidate_bitmap
>     those with type which is suitable for scalarization.  */
>  
> @@ -1350,8 +1358,7 @@ find_var_candidates (void)
>  	      we also want to schedule it rather late.  Thus we ignore it in
>  	      the early pass. */
>  	  || (sra_mode == SRA_MODE_EARLY_INTRA
> -	      && (TYPE_MAIN_VARIANT (TREE_TYPE (var))
> -		  == TYPE_MAIN_VARIANT (va_list_type_node))))
> +	      && is_va_list_type (type)))
>  	continue;
>  
>        bitmap_set_bit (candidate_bitmap, DECL_UID (var));
> @@ -2731,11 +2738,13 @@ find_param_candidates (void)
>         parm;
>         parm = TREE_CHAIN (parm))
>      {
> -      tree type;
> +      tree type = TREE_TYPE (parm);
>  
>        count++;
> +
>        if (TREE_THIS_VOLATILE (parm)
> -	  || TREE_ADDRESSABLE (parm))
> +	  || TREE_ADDRESSABLE (parm)
> +	  || is_va_list_type (type))
>  	continue;
>  
>        if (is_unused_scalar_param (parm))
> @@ -2744,7 +2753,6 @@ find_param_candidates (void)
>  	  continue;
>  	}
>  
> -      type = TREE_TYPE (parm);
>        if (POINTER_TYPE_P (type))
>  	{
>  	  type = TREE_TYPE (type);
> @@ -2752,6 +2760,7 @@ find_param_candidates (void)
>  	  if (TREE_CODE (type) == FUNCTION_TYPE
>  	      || TYPE_VOLATILE (type)
>  	      || !is_gimple_reg (parm)
> +	      || is_va_list_type (type)
>  	      || ptr_parm_has_direct_uses (parm))
>  	    continue;
>  	}
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex


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