tree.h (SSA_VAR_P): Simplify.
authorRichard Guenther <rguenther@suse.de>
Thu, 9 Aug 2012 11:00:11 +0000 (11:00 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 9 Aug 2012 11:00:11 +0000 (11:00 +0000)
2012-08-09  Richard Guenther  <rguenther@suse.de>

* tree.h (SSA_VAR_P): Simplify.
* tree-ssanames.c (make_ssa_name_fn): Strengthen assert.
* fold-const.c (fold_comparison): Check for default def first
before checking for PARM_DECL.
* tree-complex.c (get_component_ssa_name): Likewise.
* tree-inline.c (remap_ssa_name): Likewise.
* tree-ssa-loop-ivopts.c (parm_decl_cost): Likewise.
* tree-ssa-structalias.c (get_fi_for_callee): Likewise.
(find_what_p_points_to): Likewise.
* tree-ssa-operands.c (add_stmt_operand): Simplify.

From-SVN: r190250

gcc/ChangeLog
gcc/fold-const.c
gcc/tree-complex.c
gcc/tree-inline.c
gcc/tree-ssa-loop-ivopts.c
gcc/tree-ssa-operands.c
gcc/tree-ssa-structalias.c
gcc/tree-ssanames.c
gcc/tree.h

index e8554ec..36302bf 100644 (file)
@@ -1,3 +1,16 @@
+2012-08-09  Richard Guenther  <rguenther@suse.de>
+
+       * tree.h (SSA_VAR_P): Simplify.
+       * tree-ssanames.c (make_ssa_name_fn): Strengthen assert.
+       * fold-const.c (fold_comparison): Check for default def first
+       before checking for PARM_DECL.
+       * tree-complex.c (get_component_ssa_name): Likewise.
+       * tree-inline.c (remap_ssa_name): Likewise.
+       * tree-ssa-loop-ivopts.c (parm_decl_cost): Likewise.
+       * tree-ssa-structalias.c (get_fi_for_callee): Likewise.
+       (find_what_p_points_to): Likewise.
+       * tree-ssa-operands.c (add_stmt_operand): Simplify.
+
 2012-08-08  Joseph Myers  <joseph@codesourcery.com>
 
        * simplify-rtx.c (simplify_binary_operation_1): Do not simplify
index dfc01cc..74fbb2a 100644 (file)
@@ -8940,16 +8940,16 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
            && auto_var_in_fn_p (base0, current_function_decl)
            && !indirect_base1
            && TREE_CODE (base1) == SSA_NAME
-           && TREE_CODE (SSA_NAME_VAR (base1)) == PARM_DECL
-           && SSA_NAME_IS_DEFAULT_DEF (base1))
+           && SSA_NAME_IS_DEFAULT_DEF (base1)
+          && TREE_CODE (SSA_NAME_VAR (base1)) == PARM_DECL)
           || (TREE_CODE (arg1) == ADDR_EXPR
               && indirect_base1
               && TREE_CODE (base1) == VAR_DECL
               && auto_var_in_fn_p (base1, current_function_decl)
               && !indirect_base0
               && TREE_CODE (base0) == SSA_NAME
-              && TREE_CODE (SSA_NAME_VAR (base0)) == PARM_DECL
-              && SSA_NAME_IS_DEFAULT_DEF (base0)))
+              && SSA_NAME_IS_DEFAULT_DEF (base0)
+             && TREE_CODE (SSA_NAME_VAR (base0)) == PARM_DECL))
         {
           if (code == NE_EXPR)
             return constant_boolean_node (1, type);
index 82ec14a..a34d048 100644 (file)
@@ -495,8 +495,8 @@ get_component_ssa_name (tree ssa_name, bool imag_p)
         is used in an abnormal phi, and whether it's uninitialized.  */
       SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ret)
        = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name);
-      if (TREE_CODE (SSA_NAME_VAR (ssa_name)) == VAR_DECL
-         && SSA_NAME_IS_DEFAULT_DEF (ssa_name))
+      if (SSA_NAME_IS_DEFAULT_DEF (ssa_name)
+         && TREE_CODE (SSA_NAME_VAR (ssa_name)) == VAR_DECL)
        {
          SSA_NAME_DEF_STMT (ret) = SSA_NAME_DEF_STMT (ssa_name);
          set_ssa_default_def (cfun, SSA_NAME_VAR (ret), ret);
index 04c3109..6b6b78c 100644 (file)
@@ -187,8 +187,8 @@ remap_ssa_name (tree name, copy_body_data *id)
 
   if (processing_debug_stmt)
     {
-      if (TREE_CODE (SSA_NAME_VAR (name)) == PARM_DECL
-         && SSA_NAME_IS_DEFAULT_DEF (name)
+      if (SSA_NAME_IS_DEFAULT_DEF (name)
+         && TREE_CODE (SSA_NAME_VAR (name)) == PARM_DECL
          && id->entry_bb == NULL
          && single_succ_p (ENTRY_BLOCK_PTR))
        {
index d5fa6ed..ae3c32b 100644 (file)
@@ -4642,8 +4642,8 @@ parm_decl_cost (struct ivopts_data *data, tree bound)
   STRIP_NOPS (sbound);
 
   if (TREE_CODE (sbound) == SSA_NAME
+      && SSA_NAME_IS_DEFAULT_DEF (sbound)
       && TREE_CODE (SSA_NAME_VAR (sbound)) == PARM_DECL
-      && gimple_nop_p (SSA_NAME_DEF_STMT (sbound))
       && data->body_includes_call)
     return COSTS_N_INSNS (1);
 
index 67e6f93..3a1f989 100644 (file)
@@ -615,19 +615,11 @@ add_virtual_operand (gimple stmt ATTRIBUTE_UNUSED, int flags)
 static void
 add_stmt_operand (tree *var_p, gimple stmt, int flags)
 {
-  tree var, sym;
+  tree var = *var_p;
 
   gcc_assert (SSA_VAR_P (*var_p));
 
-  var = *var_p;
-  sym = (TREE_CODE (var) == SSA_NAME ? SSA_NAME_VAR (var) : var);
-
-  /* Mark statements with volatile operands.  */
-  if (!(flags & opf_no_vops)
-      && TREE_THIS_VOLATILE (sym))
-    gimple_set_has_volatile_ops (stmt, true);
-
-  if (is_gimple_reg (sym))
+  if (is_gimple_reg (var))
     {
       /* The variable is a GIMPLE register.  Add it to real operands.  */
       if (flags & opf_def)
@@ -636,7 +628,15 @@ add_stmt_operand (tree *var_p, gimple stmt, int flags)
        append_use (var_p);
     }
   else
-    add_virtual_operand (stmt, flags);
+    {
+      /* Mark statements with volatile operands.  */
+      if (!(flags & opf_no_vops)
+         && TREE_THIS_VOLATILE (var))
+       gimple_set_has_volatile_ops (stmt, true);
+
+      /* The variable is a memory access.  Add virtual operands.  */
+      add_virtual_operand (stmt, flags);
+    }
 }
 
 /* Mark the base address of REF as having its address taken.
index 060ca8a..2b38e44 100644 (file)
@@ -3976,9 +3976,9 @@ get_fi_for_callee (gimple call)
   if (!fn || TREE_CODE (fn) != SSA_NAME)
     return get_varinfo (anything_id);
 
-  if ((TREE_CODE (SSA_NAME_VAR (fn)) == PARM_DECL
-       || TREE_CODE (SSA_NAME_VAR (fn)) == RESULT_DECL)
-      && SSA_NAME_IS_DEFAULT_DEF (fn))
+  if (SSA_NAME_IS_DEFAULT_DEF (fn)
+      && (TREE_CODE (SSA_NAME_VAR (fn)) == PARM_DECL
+         || TREE_CODE (SSA_NAME_VAR (fn)) == RESULT_DECL))
     fn = SSA_NAME_VAR (fn);
 
   return get_vi_for_tree (fn);
@@ -5915,9 +5915,9 @@ find_what_p_points_to (tree p)
   /* For parameters, get at the points-to set for the actual parm
      decl.  */
   if (TREE_CODE (p) == SSA_NAME
+      && SSA_NAME_IS_DEFAULT_DEF (p)
       && (TREE_CODE (SSA_NAME_VAR (p)) == PARM_DECL
-         || TREE_CODE (SSA_NAME_VAR (p)) == RESULT_DECL)
-      && SSA_NAME_IS_DEFAULT_DEF (p))
+         || TREE_CODE (SSA_NAME_VAR (p)) == RESULT_DECL))
     lookup_p = SSA_NAME_VAR (p);
 
   vi = lookup_vi_for_tree (lookup_p);
index b9036e2..9e7b156 100644 (file)
@@ -118,7 +118,9 @@ make_ssa_name_fn (struct function *fn, tree var, gimple stmt)
   tree t;
   use_operand_p imm;
 
-  gcc_assert (DECL_P (var));
+  gcc_assert (TREE_CODE (var) == VAR_DECL
+             || TREE_CODE (var) == PARM_DECL
+             || TREE_CODE (var) == RESULT_DECL);
 
   /* If our free list has an element, then use it.  */
   if (!VEC_empty (tree, FREE_SSANAMES (fn)))
index b28f35a..9a47607 100644 (file)
@@ -2635,16 +2635,13 @@ struct GTY (()) tree_binfo {
 \f
 /* Define fields and accessors for nodes representing declared names.  */
 
-/* Nonzero if DECL represents a variable for the SSA passes.  */
+/* Nonzero if DECL represents an SSA name or a variable that can possibly
+   have an associated SSA name.  */
 #define SSA_VAR_P(DECL)                                                        \
        (TREE_CODE (DECL) == VAR_DECL                                   \
         || TREE_CODE (DECL) == PARM_DECL                               \
         || TREE_CODE (DECL) == RESULT_DECL                             \
-        || (TREE_CODE (DECL) == SSA_NAME                               \
-            && (TREE_CODE (SSA_NAME_VAR (DECL)) == VAR_DECL            \
-                || TREE_CODE (SSA_NAME_VAR (DECL)) == PARM_DECL        \
-                || TREE_CODE (SSA_NAME_VAR (DECL)) == RESULT_DECL)))
-
+        || TREE_CODE (DECL) == SSA_NAME)