summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-14 13:00:44 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-14 13:00:44 +0000
commit1f0f7e1ea4232aa0c1378092fc856fa584e60e5e (patch)
treeaba8befd3c64b2c2d7015e8c092e44778329671f /gcc/tree-vect-data-refs.c
parent8d8a34f99014fc6fa6df5198b6199f15d2a60f35 (diff)
downloadgcc-1f0f7e1ea4232aa0c1378092fc856fa584e60e5e.tar.gz
2012-03-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/52571 * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Move flag_section_anchors check ... (vect_can_force_dr_alignment_p): ... here. Do not re-align DECL_COMMON variables. * gcc.dg/vect/vect-2.c: Initialize arrays. * gcc.dg/vect/no-section-anchors-vect-34.c: Likewise. * gcc.target/i386/recip-vec-divf.c: Use -fno-common. * gcc.target/i386/recip-vec-sqrtf.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185380 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r--gcc/tree-vect-data-refs.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index b458d624d64..9b66d86d124 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -872,10 +872,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
if (!base_aligned)
{
- /* Do not change the alignment of global variables if
- flag_section_anchors is enabled. */
- if (!vect_can_force_dr_alignment_p (base, TYPE_ALIGN (vectype))
- || (TREE_STATIC (base) && flag_section_anchors))
+ if (!vect_can_force_dr_alignment_p (base, TYPE_ALIGN (vectype)))
{
if (vect_print_dump_info (REPORT_DETAILS))
{
@@ -4546,12 +4543,22 @@ vect_can_force_dr_alignment_p (const_tree decl, unsigned int alignment)
if (TREE_CODE (decl) != VAR_DECL)
return false;
- if (DECL_EXTERNAL (decl))
+ /* We cannot change alignment of common or external symbols as another
+ translation unit may contain a definition with lower alignment.
+ The rules of common symbol linking mean that the definition
+ will override the common symbol. */
+ if (DECL_EXTERNAL (decl)
+ || DECL_COMMON (decl))
return false;
if (TREE_ASM_WRITTEN (decl))
return false;
+ /* Do not change the alignment of global variables if flag_section_anchors
+ is enabled. */
+ if (TREE_STATIC (decl) && flag_section_anchors)
+ return false;
+
if (TREE_STATIC (decl))
return (alignment <= MAX_OFILE_ALIGNMENT);
else