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] Fix PR50494


On Thu, 14 Feb 2013, Jakub Jelinek wrote:

> On Wed, Feb 13, 2013 at 01:04:04PM +0100, Richard Biener wrote:
> > 2013-02-13  Richard Biener  <rguenther@suse.de>
> > 
> > 	PR lto/50494
> > 	* varasm.c (output_constant_def_1): Get the decl representing
> > 	the constant as argument.
> > 	(output_constant_def): Wrap output_constant_def_1.
> > 	(make_decl_rtl): Use output_constant_def_1 with the decl
> > 	representing the constant.
> > 	(build_constant_desc): Optionally re-use a decl already
> > 	representing the constant.
> > 	(tree_output_constant_def): Adjust.
> 
> Looks good to me, except formatting nit:
> 
> > + /* Like output_constant_def but create a new decl representing the
> > +    constant if necessary.  */
> > + 
> > + rtx
> > + output_constant_def (tree exp, int defer)
> > + {
> > +   return  output_constant_def_1  (exp, NULL_TREE, defer);
> 
> Twice too many spaces.
> 
> But I'd say we should also add some varasm.c function that
> increase_alignment should call for
> (TREE_CODE (decl) == VAR_DECL && DECL_IN_CONSTANT_POOL (decl))
> vars upon increasing alignment of the decl, which would do something like:
> void
> adjust_const_pool_alignment (tree decl)
> {
>   struct constant_descriptor_tree *desc, key;
> 
>   gcc_assert (TREE_CODE (decl) == VAR_DECL && DECL_IN_CONSTANT_POOL (decl));
>   key.value = DECL_INITIAL (decl);
>   key.hash = const_hash_1 (DECL_INITIAL (decl));
>   desc = (struct constant_descriptor_tree *)
> 	 htab_find_with_hash (const_desc_htab, &key, key.hash);
>   if (desc && MEM_P (desc) && MEM_ALIGN (desc->rtl) < DECL_ALIGN (decl))
>     set_mem_align (desc->rtl, DECL_ALIGN (decl));
> }
> (completely untested).  Because, if we force the constant to be aligned
> more than it would be by default, the RTL optimizers should be told about
> that too.

At the moment the vectorizer refuses to bump alignment for anything
with TREE_ASM_WRITTEN set.  I suppose that should rather be checking
DECL_RTL_SET_P.  Btw, isn't the constants descriptor ->rtl always
that of DECL_RTL of the decl?

But yes, we should have a proper abstraction for can_adjust_alignment
and adjust_alignment.  But we should use that for all decls, not
just DECL_IN_CONSTANT_POOL.

Thanks,
Richard.


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