From caf2df93de6eda7d35f78e31517a13a3676b1f5c Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Tue, 10 Mar 2015 05:24:21 +0100 Subject: [PATCH] re PR tree-optimization/65355 (vectorizer increase alignment of symbols already placed in anchors) PR tree-optimization/65355 * varasm.c (notice_global_symbol): Do not produce RTL. * symtab.c (symtab_node::can_increase_alignment_p): Check for section anchor. * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Do not check for section anchors. * gcc.dg/vect/section-anchors-vect-69.c: Update template. From-SVN: r221297 --- gcc/ChangeLog | 9 ++++++++ gcc/symtab.c | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ .../gcc.dg/vect/section-anchors-vect-69.c | 2 +- gcc/tree-vect-data-refs.c | 7 +------ gcc/varasm.c | 21 +++++++------------ 6 files changed, 31 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6526a8e8d12..0cbeaa3b9e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-03-10 Jan Hubicka + + PR tree-optimization/65355 + * varasm.c (notice_global_symbol): Do not produce RTL. + * symtab.c (symtab_node::can_increase_alignment_p): Check for section + anchor. + * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Do not + check for section anchors. + 2015-03-10 Alan Modra PR target/65286 diff --git a/gcc/symtab.c b/gcc/symtab.c index 38337349d15..88e168bd193 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1924,6 +1924,13 @@ symtab_node::can_increase_alignment_p (void) if (TREE_ASM_WRITTEN (target->decl)) return false; + /* If target is already placed in an anchor, we can not touch its + alignment. */ + if (DECL_RTL_SET_P (target->decl) + && MEM_P (DECL_RTL (target->decl)) + && SYMBOL_REF_HAS_BLOCK_INFO_P (XEXP (DECL_RTL (target->decl), 0))) + return false; + /* Constant pool entries may be shared. */ if (DECL_IN_CONSTANT_POOL (target->decl)) return false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2287409fb0a..ec7a3bc5ba4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-10 Jan Hubicka + + PR tree-optimization/65355 + * gcc.dg/vect/section-anchors-vect-69.c: Update template. + 2015-03-09 Jakub Jelinek PR c/65120 diff --git a/gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c b/gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c index 7b5ce734884..4916274fb0a 100644 --- a/gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c +++ b/gcc/testsuite/gcc.dg/vect/section-anchors-vect-69.c @@ -115,6 +115,6 @@ int main (void) /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ /* Alignment forced using versioning until the pass that increases alignment is extended to handle structs. */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 4 "vect" { target {vect_int && vector_alignment_reachable } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target {vect_int && vector_alignment_reachable } } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 4 "vect" { target {vect_int && {! vector_alignment_reachable} } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 5ff6307e1ac..b308ac7ac68 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -758,12 +758,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr) && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR) base = TREE_OPERAND (TREE_OPERAND (base, 0), 0); - /* Do not change the alignment of global variables here if - flag_section_anchors is enabled as we already generated - RTL for other functions. Most global variables should - have been aligned during the IPA increase_alignment pass. */ - 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 (dump_enabled_p ()) { diff --git a/gcc/varasm.c b/gcc/varasm.c index 5fa6e4c3de4..752dccf935d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1630,35 +1630,30 @@ default_ctor_section_asm_out_constructor (rtx symbol, void notice_global_symbol (tree decl) { - const char **type = &first_global_object_name; + const char **t = &first_global_object_name; if (first_global_object_name || !TREE_PUBLIC (decl) || DECL_EXTERNAL (decl) || !DECL_NAME (decl) + || (TREE_CODE (decl) == VAR_DECL && DECL_HARD_REGISTER (decl)) || (TREE_CODE (decl) != FUNCTION_DECL && (TREE_CODE (decl) != VAR_DECL || (DECL_COMMON (decl) && (DECL_INITIAL (decl) == 0 - || DECL_INITIAL (decl) == error_mark_node)))) - || !MEM_P (DECL_RTL (decl))) + || DECL_INITIAL (decl) == error_mark_node))))) return; /* We win when global object is found, but it is useful to know about weak symbol as well so we can produce nicer unique names. */ if (DECL_WEAK (decl) || DECL_ONE_ONLY (decl) || flag_shlib) - type = &weak_global_object_name; + t = &weak_global_object_name; - if (!*type) + if (!*t) { - const char *p; - const char *name; - rtx decl_rtl = DECL_RTL (decl); - - p = targetm.strip_name_encoding (XSTR (XEXP (decl_rtl, 0), 0)); - name = ggc_strdup (p); - - *type = name; + tree id = DECL_ASSEMBLER_NAME (decl); + ultimate_transparent_alias_target (&id); + *t = ggc_strdup (targetm.strip_name_encoding (IDENTIFIER_POINTER (id))); } } -- 2.30.2