OSDN Git Service

Mark ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / ipa-prop.c
index 0ca3f3a..7ccd5ba 100644 (file)
@@ -1,5 +1,5 @@
 /* Interprocedural analyses.
-   Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011
+   Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011, 2012
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -230,8 +230,8 @@ ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node)
        continue;
 
       fprintf (f, "    callsite  %s/%i -> %s/%i : \n",
-              cgraph_node_name (node), node->uid,
-              cgraph_node_name (cs->callee), cs->callee->uid);
+              xstrdup (cgraph_node_name (node)), node->uid,
+              xstrdup (cgraph_node_name (cs->callee)), cs->callee->uid);
       ipa_print_node_jump_functions_for_edge (f, cs);
     }
 
@@ -442,13 +442,11 @@ detect_type_change_1 (tree arg, tree base, tree comp_type, gimple call,
   if (!flag_devirtualize || !gimple_vuse (call))
     return false;
 
-  ao.ref = arg;
+  ao_ref_init (&ao, arg);
   ao.base = base;
   ao.offset = offset;
   ao.size = POINTER_SIZE;
   ao.max_size = ao.size;
-  ao.ref_alias_set = -1;
-  ao.base_alias_set = -1;
 
   tci.offset = offset;
   tci.object = get_base_address (arg);
@@ -1782,8 +1780,8 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
       fprintf (dump_file, "ipa-prop: Discovered %s call to a known target "
               "(%s/%i -> %s/%i), for stmt ",
               ie->indirect_info->polymorphic ? "a virtual" : "an indirect",
-              cgraph_node_name (ie->caller), ie->caller->uid,
-              cgraph_node_name (ie->callee), ie->callee->uid);
+              xstrdup (cgraph_node_name (ie->caller)), ie->caller->uid,
+              xstrdup (cgraph_node_name (ie->callee)), ie->callee->uid);
       if (ie->call_stmt)
        print_gimple_stmt (dump_file, ie->call_stmt, 2, TDF_SLIM);
       else
@@ -1905,6 +1903,10 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs,
       if (new_direct_edge)
        {
          new_direct_edge->indirect_inlining_edge = 1;
+         if (new_direct_edge->call_stmt)
+           new_direct_edge->call_stmt_cannot_inline_p
+             = !gimple_check_call_matching_types (new_direct_edge->call_stmt,
+                                                  new_direct_edge->callee->decl);
          if (new_edges)
            {
              VEC_safe_push (cgraph_edge_p, heap, *new_edges,
@@ -2506,9 +2508,27 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
                }
            }
 
-         expr = fold_build2_loc (loc, MEM_REF, adj->type, base, off);
-         if (adj->by_ref)
-           expr = build_fold_addr_expr (expr);
+         if (!adj->by_ref)
+           {
+             tree type = adj->type;
+             unsigned int align;
+             unsigned HOST_WIDE_INT misalign;
+             align = get_pointer_alignment_1 (base, &misalign);
+             misalign += (double_int_sext (tree_to_double_int (off),
+                                           TYPE_PRECISION (TREE_TYPE (off))).low
+                          * BITS_PER_UNIT);
+             misalign = misalign & (align - 1);
+             if (misalign != 0)
+               align = (misalign & -misalign);
+             if (align < TYPE_ALIGN (type))
+               type = build_aligned_type (type, align);
+             expr = fold_build2_loc (loc, MEM_REF, type, base, off);
+           }
+         else
+           {
+             expr = fold_build2_loc (loc, MEM_REF, adj->type, base, off);
+             expr = build_fold_addr_expr (expr);
+           }
 
          expr = force_gimple_operand_gsi (&gsi, expr,
                                           adj->by_ref
@@ -2568,8 +2588,8 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
   gimple_set_block (new_stmt, gimple_block (stmt));
   if (gimple_has_location (stmt))
     gimple_set_location (new_stmt, gimple_location (stmt));
-  gimple_call_copy_flags (new_stmt, stmt);
   gimple_call_set_chain (new_stmt, gimple_call_chain (stmt));
+  gimple_call_copy_flags (new_stmt, stmt);
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
@@ -2999,9 +3019,9 @@ ipa_prop_read_section (struct lto_file_decl_data *file_data, const char *data,
 {
   const struct lto_function_header *header =
     (const struct lto_function_header *) data;
-  const int32_t cfg_offset = sizeof (struct lto_function_header);
-  const int32_t main_offset = cfg_offset + header->cfg_size;
-  const int32_t string_offset = main_offset + header->main_size;
+  const int cfg_offset = sizeof (struct lto_function_header);
+  const int main_offset = cfg_offset + header->cfg_size;
+  const int string_offset = main_offset + header->main_size;
   struct data_in *data_in;
   struct lto_input_block ib_main;
   unsigned int i;