> On Fri, Jun 13, 2014 at 12:14 AM, Jan Hubicka <hubi...@ucw.cz> wrote: > > Hi, > > while updating vect_can_force_dr_alignment_p for section API I noticed the > > predicate is bit confused about when it can update the alignment. > > > > We need to check that decl_binds_to_current_def_p and in case we compile > > a partition also that the symbol is not homed in other partition. > > Previous code was wrong i.e. for COMDATs, weaks or -fpic. > > > > Also when having an alias, only way to promote the alignment is to bump > > up alignment of target. > > > > On the other hand comment about DECL_IN_CONSTANT_POOL seems confused - we > > have > > no sharing across partitions. I assume it was old hack and removed it. > > I don't think that code was confused. It's because of the way we emit > the constant pool and use its hash (we duplicate the decl). Do a svn > blame and see for the associated PR which you now broke again > I guess. It wasn't about LTO I think.
It is middle-end/50494. I have re-instantiated the check and also added back TREE_ASM_WRITTEN that is needed in the case of -fno-toplevel-reorder. I will try to look into the constant pool output machinery but indeed it is a nasty problem. Thanks, Honza Index: ChangeLog =================================================================== --- ChangeLog (revision 211689) +++ ChangeLog (working copy) @@ -1,5 +1,10 @@ 2014-06-15 Jan Hubicka <hubi...@ucw.cz> + * tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Check again + DECL_IN_CONSTANT_POOL and TREE_ASM_WRITTEN. + +2014-06-15 Jan Hubicka <hubi...@ucw.cz> + * c-family/c-common.c (handle_tls_model_attribute): Use set_decl_tls_model. * cgraph.h (struct varpool_node): Add tls_model. * tree.c (decl_tls_model, set_decl_tls_model): New functions. Index: tree-vect-data-refs.c =================================================================== --- tree-vect-data-refs.c (revision 211688) +++ tree-vect-data-refs.c (working copy) @@ -5317,7 +5317,13 @@ vect_can_force_dr_alignment_p (const_tre if (TREE_CODE (decl) != VAR_DECL) return false; - gcc_assert (!TREE_ASM_WRITTEN (decl)); + /* With -fno-toplevel-reorder we may have already output the constant. */ + if (TREE_ASM_WRITTEN (decl)) + return false; + + /* Constant pool entries may be shared and not properly merged by LTO. */ + if (DECL_IN_CONSTANT_POOL (decl)) + return false; if (TREE_PUBLIC (decl) || DECL_EXTERNAL (decl)) {