Re: Fix vectorizer alignment update wrt section anchors

2015-03-09 Thread Jakub Jelinek
On Mon, Mar 09, 2015 at 04:38:57AM +0100, Jan Hubicka wrote:
 --- varasm.c  (revision 221269)
 +++ varasm.c  (working copy)
 @@ -1630,35 +1630,30 @@ default_ctor_section_asm_out_constructor
  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);

make_decl_rtl only calls this for:
  if (TREE_CODE (decl) == FUNCTION_DECL
   cgraph_node::get (decl)
   cgraph_node::get (decl)-instrumentation_clone)
Is it intentional you are doing it unconditionally?

 +  *t = ggc_strdup (targetm.strip_name_encoding (IDENTIFIER_POINTER 
 (id)));

Otherwise it looks reasonable.  Another option would be to just create the
RTL for notice_global_symbol purposes using make_decl_rtl_for_debug.

Jakub


Re: Fix vectorizer alignment update wrt section anchors

2015-03-09 Thread Jan Hubicka
 make_decl_rtl only calls this for:
   if (TREE_CODE (decl) == FUNCTION_DECL
cgraph_node::get (decl)
cgraph_node::get (decl)-instrumentation_clone)
 Is it intentional you are doing it unconditionally?

Yes, ultimate_transparent_alias_target is either called in make_decl_rtl or in
assemble_name. I do not think there is way the symbol can land into .s file
untranslated.

I must admit I am surprised instrumentation_clones need any special handling 
here.
instrumentation clones have special cases all over symbol table/cgrap code. I 
need
to get familiar with these.

 
  +  *t = ggc_strdup (targetm.strip_name_encoding (IDENTIFIER_POINTER 
  (id)));
 
 Otherwise it looks reasonable.  Another option would be to just create the
 RTL for notice_global_symbol purposes using make_decl_rtl_for_debug.

Hmm, did not know about this one, but I think avoiding RTL here is best.
Thanks for comments!

Honza
 
   Jakub