aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-03-14 13:00:44 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-03-14 13:00:44 +0000
commitc205d0b3f5d47699977946add69e4409898d5cbc (patch)
treeaba8befd3c64b2c2d7015e8c092e44778329671f /gcc/tree-vect-data-refs.c
parent26c71b9368c1ef1929205fe1aafab1748640596b (diff)
downloadgcc-c205d0b3f5d47699977946add69e4409898d5cbc.zip
gcc-c205d0b3f5d47699977946add69e4409898d5cbc.tar.gz
gcc-c205d0b3f5d47699977946add69e4409898d5cbc.tar.bz2
re PR tree-optimization/52571 (vectorizer changes alignment of common symbols)
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. From-SVN: r185380
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 b458d62..9b66d86 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