OSDN Git Service

PR c++/27292
[pf3gnuchains/gcc-fork.git] / gcc / tree-inline.c
index 99bc068..309bb40 100644 (file)
@@ -266,7 +266,6 @@ remap_type_1 (tree type, copy_body_data *id)
     case REAL_TYPE:
     case ENUMERAL_TYPE:
     case BOOLEAN_TYPE:
-    case CHAR_TYPE:
       t = TYPE_MIN_VALUE (new);
       if (t && TREE_CODE (t) != INTEGER_CST)
         walk_tree (&TYPE_MIN_VALUE (new), copy_body_r, id, NULL);
@@ -591,6 +590,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
          if (n)
            {
              tree new;
+             tree old;
              /* If we happen to get an ADDR_EXPR in n->value, strip
                 it manually here as we'll eventually get ADDR_EXPRs
                 which lie about their types pointed to.  In this case
@@ -599,13 +599,17 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
                 does other useful transformations, try that first, though.  */
              tree type = TREE_TYPE (TREE_TYPE ((tree)n->value));
              new = unshare_expr ((tree)n->value);
+             old = *tp;
              *tp = fold_indirect_ref_1 (type, new);
              if (! *tp)
                {
                  if (TREE_CODE (new) == ADDR_EXPR)
                    *tp = TREE_OPERAND (new, 0);
                  else
-                   *tp = build1 (INDIRECT_REF, type, new);
+                   {
+                     *tp = build1 (INDIRECT_REF, type, new);
+                     TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
+                   }
                }
              *walk_subtrees = 0;
              return NULL;
@@ -894,7 +898,7 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency,
       *new_cfun = *DECL_STRUCT_FUNCTION (callee_fndecl);
       new_cfun->cfg = NULL;
       new_cfun->decl = new_fndecl = copy_node (callee_fndecl);
-      new_cfun->ib_boundaries_block = (varray_type) 0;
+      new_cfun->ib_boundaries_block = NULL;
       DECL_STRUCT_FUNCTION (new_fndecl) = new_cfun;
       push_cfun (new_cfun);
       init_empty_tree_cfg ();
@@ -925,7 +929,8 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency,
       if (id->transform_new_cfg)
         init_eh_for_function ();
       id->eh_region_offset
-       = duplicate_eh_regions (cfun_to_copy, remap_decl_1, id, id->eh_region);
+       = duplicate_eh_regions (cfun_to_copy, remap_decl_1, id,
+                               0, id->eh_region);
     }
   /* Use aux pointers to map the original blocks to copy.  */
   FOR_EACH_BB_FN (bb, cfun_to_copy)
@@ -1223,6 +1228,10 @@ declare_return_variable (copy_body_data *id, tree return_slot_addr,
            use_it = false;
          else if (is_global_var (base_m))
            use_it = false;
+         else if (TREE_CODE (TREE_TYPE (result)) == COMPLEX_TYPE
+                  && !DECL_COMPLEX_GIMPLE_REG_P (result)
+                  && DECL_COMPLEX_GIMPLE_REG_P (base_m))
+           use_it = false;
          else if (!TREE_ADDRESSABLE (base_m))
            use_it = true;
        }
@@ -1598,17 +1607,9 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
     case LOOP_EXPR:
     case PHI_NODE:
     case WITH_SIZE_EXPR:
-    case OMP_PARALLEL:
-    case OMP_FOR:
-    case OMP_SECTIONS:
-    case OMP_SINGLE:
-    case OMP_SECTION:
-    case OMP_MASTER:
-    case OMP_ORDERED:
-    case OMP_CRITICAL:
-    case OMP_ATOMIC:
     case OMP_CLAUSE:
-    case OMP_RETURN_EXPR:
+    case OMP_RETURN:
+    case OMP_CONTINUE:
       break;
 
     /* We don't account constants for now.  Assume that the cost is amortized
@@ -1795,6 +1796,20 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
        *count += PARAM_VALUE (PARAM_INLINE_CALL_COST);
        break;
       }
+
+    case OMP_PARALLEL:
+    case OMP_FOR:
+    case OMP_SECTIONS:
+    case OMP_SINGLE:
+    case OMP_SECTION:
+    case OMP_MASTER:
+    case OMP_ORDERED:
+    case OMP_CRITICAL:
+    case OMP_ATOMIC:
+      /* OpenMP directives are generally very expensive.  */
+      *count += 40;
+      break;
+
     default:
       gcc_unreachable ();
     }
@@ -2063,6 +2078,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
       if (CALL_EXPR_RETURN_SLOT_OPT (t))
        {
          return_slot_addr = build_fold_addr_expr (modify_dest);
+         STRIP_USELESS_TYPE_CONVERSION (return_slot_addr);
          modify_dest = NULL;
        }
     }