Commit 6ad386b7 by Jan Hubicka Committed by Jan Hubicka

tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Reorg to use symtab and…

tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Reorg to use symtab and decl_binds_to_current_def_p

	* tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Reorg
	to use symtab and decl_binds_to_current_def_p
	* tree-vectorizer.c (increase_alignment): Increase alignment
	of alias target, too.

From-SVN: r211599
parent 9cf32741
2014-06-12 Jan Hubicka <hubicka@ucw.cz>
* tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Reorg
to use symtab and decl_binds_to_current_def_p
* tree-vectorizer.c (increase_alignment): Increase alignment
of alias target, too.
2014-06-12 Jakub Jelinek <jakub@redhat.com> 2014-06-12 Jakub Jelinek <jakub@redhat.com>
PR middle-end/61486 PR middle-end/61486
......
...@@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
#include "expr.h" #include "expr.h"
#include "optabs.h" #include "optabs.h"
#include "builtins.h" #include "builtins.h"
#include "varasm.h"
/* Return true if load- or store-lanes optab OPTAB is implemented for /* Return true if load- or store-lanes optab OPTAB is implemented for
COUNT vectors of type VECTYPE. NAME is the name of OPTAB. */ COUNT vectors of type VECTYPE. NAME is the name of OPTAB. */
...@@ -5316,19 +5317,26 @@ vect_can_force_dr_alignment_p (const_tree decl, unsigned int alignment) ...@@ -5316,19 +5317,26 @@ vect_can_force_dr_alignment_p (const_tree decl, unsigned int alignment)
if (TREE_CODE (decl) != VAR_DECL) if (TREE_CODE (decl) != VAR_DECL)
return false; return false;
/* We cannot change alignment of common or external symbols as another gcc_assert (!TREE_ASM_WRITTEN (decl));
translation unit may contain a definition with lower alignment.
The rules of common symbol linking mean that the definition if (TREE_PUBLIC (decl) || DECL_EXTERNAL (decl))
will override the common symbol. The same is true for constant {
pool entries which may be shared and are not properly merged symtab_node *snode;
by LTO. */
if (DECL_EXTERNAL (decl) /* We cannot change alignment of symbols that may bind to symbols
|| DECL_COMMON (decl) in other translation unit that may contain a definition with lower
|| DECL_IN_CONSTANT_POOL (decl)) alignment. */
if (!decl_binds_to_current_def_p (decl))
return false; return false;
if (TREE_ASM_WRITTEN (decl)) /* When compiling partition, be sure the symbol is not output by other
partition. */
snode = symtab_get_node (decl);
if (flag_ltrans
&& (snode->in_other_partition
|| symtab_get_symbol_partitioning_class (snode) == SYMBOL_DUPLICATE))
return false; return false;
}
/* Do not override the alignment as specified by the ABI when the used /* Do not override the alignment as specified by the ABI when the used
attribute is set. */ attribute is set. */
...@@ -5343,6 +5351,18 @@ vect_can_force_dr_alignment_p (const_tree decl, unsigned int alignment) ...@@ -5343,6 +5351,18 @@ vect_can_force_dr_alignment_p (const_tree decl, unsigned int alignment)
&& !symtab_get_node (decl)->implicit_section) && !symtab_get_node (decl)->implicit_section)
return false; return false;
/* If symbol is an alias, we need to check that target is OK. */
if (TREE_STATIC (decl))
{
tree target = symtab_alias_ultimate_target (symtab_get_node (decl))->decl;
if (target != decl)
{
if (DECL_PRESERVE_P (target))
return false;
decl = target;
}
}
if (TREE_STATIC (decl)) if (TREE_STATIC (decl))
return (alignment <= MAX_OFILE_ALIGNMENT); return (alignment <= MAX_OFILE_ALIGNMENT);
else else
......
...@@ -686,6 +686,12 @@ increase_alignment (void) ...@@ -686,6 +686,12 @@ increase_alignment (void)
{ {
DECL_ALIGN (decl) = TYPE_ALIGN (vectype); DECL_ALIGN (decl) = TYPE_ALIGN (vectype);
DECL_USER_ALIGN (decl) = 1; DECL_USER_ALIGN (decl) = 1;
if (TREE_STATIC (decl))
{
tree target = symtab_alias_ultimate_target (symtab_get_node (decl))->decl;
DECL_ALIGN (target) = TYPE_ALIGN (vectype);
DECL_USER_ALIGN (target) = 1;
}
dump_printf (MSG_NOTE, "Increasing alignment of decl: "); dump_printf (MSG_NOTE, "Increasing alignment of decl: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, decl); dump_generic_expr (MSG_NOTE, TDF_SLIM, decl);
dump_printf (MSG_NOTE, "\n"); dump_printf (MSG_NOTE, "\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment