OSDN Git Service

Revert accidental commit.
[pf3gnuchains/gcc-fork.git] / gcc / ipa-prop.c
index ec45d7c..7c7df56 100644 (file)
@@ -413,7 +413,8 @@ compute_complex_assign_jump_func (struct ipa_node_params *info,
   offset += mem_ref_offset (op1).low * BITS_PER_UNIT;
   op1 = TREE_OPERAND (op1, 0);
   if (TREE_CODE (op1) != SSA_NAME
-      || !SSA_NAME_IS_DEFAULT_DEF (op1))
+      || !SSA_NAME_IS_DEFAULT_DEF (op1)
+      || offset < 0)
     return;
 
   index = ipa_get_param_decl_index (info, SSA_NAME_VAR (op1));
@@ -490,7 +491,8 @@ compute_complex_ancestor_jump_func (struct ipa_node_params *info,
   offset += mem_ref_offset (expr).low * BITS_PER_UNIT;
   parm = TREE_OPERAND (expr, 0);
   if (TREE_CODE (parm) != SSA_NAME
-      || !SSA_NAME_IS_DEFAULT_DEF (parm))
+      || !SSA_NAME_IS_DEFAULT_DEF (parm)
+      || offset < 0)
     return;
 
   index = ipa_get_param_decl_index (info, SSA_NAME_VAR (parm));
@@ -888,7 +890,7 @@ ipa_compute_jump_functions (struct cgraph_node *node,
     {
       /* We do not need to bother analyzing calls to unknown
         functions unless they may become known during lto/whopr.  */
-      if (!cs->callee->analyzed && !flag_lto && !flag_whopr)
+      if (!cs->callee->analyzed && !flag_lto)
        continue;
       ipa_count_arguments (cs);
       /* If the descriptor of the callee is not initialized yet, we have to do
@@ -916,10 +918,15 @@ ipa_compute_jump_functions (struct cgraph_node *node,
 static tree
 ipa_get_member_ptr_load_param (tree rhs, bool use_delta)
 {
-  tree rec, ref_offset, fld_offset;
-  tree ptr_field;
-  tree delta_field;
+  tree rec, ref_field, ref_offset, fld, fld_offset, ptr_field, delta_field;
 
+  if (TREE_CODE (rhs) == COMPONENT_REF)
+    {
+      ref_field = TREE_OPERAND (rhs, 1);
+      rhs = TREE_OPERAND (rhs, 0);
+    }
+  else
+    ref_field = NULL_TREE;
   if (TREE_CODE (rhs) != MEM_REF)
     return NULL_TREE;
   rec = TREE_OPERAND (rhs, 0);
@@ -931,6 +938,20 @@ ipa_get_member_ptr_load_param (tree rhs, bool use_delta)
     return NULL_TREE;
 
   ref_offset = TREE_OPERAND (rhs, 1);
+
+  if (ref_field)
+    {
+      if (integer_nonzerop (ref_offset))
+       return NULL_TREE;
+
+      if (use_delta)
+       fld = delta_field;
+      else
+       fld = ptr_field;
+
+      return ref_field == fld ? rec : NULL_TREE;
+    }
+
   if (use_delta)
     fld_offset = byte_position (delta_field);
   else
@@ -1003,10 +1024,15 @@ ipa_note_param_call (struct cgraph_node *node, int param_index, gimple stmt,
    below, the call is on the last line:
 
      <bb 2>:
+       f$__delta_5 = f.__delta;
+       f$__pfn_24 = f.__pfn;
+
+   or
+     <bb 2>:
        f$__delta_5 = MEM[(struct  *)&f];
        f$__pfn_24 = MEM[(struct  *)&f + 4B];
 
-     ...
+   and a few lines below:
 
      <bb 5>
        D.2496_3 = (int) f$__pfn_24;
@@ -1447,7 +1473,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
   callee = cgraph_node (target);
   if (!callee)
     return NULL;
-
+  ipa_check_create_node_params ();
   cgraph_make_edge_direct (ie, callee);
   if (dump_file)
     {
@@ -2120,6 +2146,7 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
     }
 
   TREE_TYPE (fndecl) = new_type;
+  DECL_VIRTUAL_P (fndecl) = 0;
   if (otypes)
     VEC_free (tree, heap, otypes);
   VEC_free (tree, heap, oparms);
@@ -2185,7 +2212,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
 
          if (TREE_CODE (base) == ADDR_EXPR
              && DECL_P (TREE_OPERAND (base, 0)))
-           off = build_int_cst (reference_alias_ptr_type (base),
+           off = build_int_cst (TREE_TYPE (base),
                                 adj->offset / BITS_PER_UNIT);
          else if (TREE_CODE (base) != ADDR_EXPR
                   && POINTER_TYPE_P (TREE_TYPE (base)))
@@ -2208,7 +2235,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
                }
              else if (TREE_CODE (base) == MEM_REF)
                {
-                 off = build_int_cst (TREE_TYPE (TREE_OPERAND (base,1)),
+                 off = build_int_cst (TREE_TYPE (TREE_OPERAND (base, 1)),
                                       base_offset
                                       + adj->offset / BITS_PER_UNIT);
                  off = int_const_binop (PLUS_EXPR, TREE_OPERAND (base, 1),
@@ -2217,7 +2244,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
                }
              else
                {
-                 off = build_int_cst (reference_alias_ptr_type (base),
+                 off = build_int_cst (reference_alias_ptr_type (prev_base),
                                       base_offset
                                       + adj->offset / BITS_PER_UNIT);
                  base = build_fold_addr_expr (base);