summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/fold-const.c8
-rw-r--r--gcc/tree-complex.c4
-rw-r--r--gcc/tree-inline.c4
-rw-r--r--gcc/tree-ssa-loop-ivopts.c2
-rw-r--r--gcc/tree-ssa-operands.c22
-rw-r--r--gcc/tree-ssa-structalias.c10
-rw-r--r--gcc/tree-ssanames.c4
-rw-r--r--gcc/tree.h9
9 files changed, 44 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e8554ecc1a2..36302bffbcb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index dfc01cc39a5..74fbb2a135f 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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);
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 82ec14a7a6f..a34d04842f2 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -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);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 04c3109e94b..6b6b78cab8b 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -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))
{
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index d5fa6edbdfd..ae3c32b1d67 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -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);
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 67e6f935972..3a1f989c8b7 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -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.
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 060ca8aa1ab..2b38e44b2b9 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -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);
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index b9036e2ec50..9e7b1560143 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -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)))
diff --git a/gcc/tree.h b/gcc/tree.h
index b28f35aa6e9..9a476072aa1 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2635,16 +2635,13 @@ struct GTY (()) tree_binfo {
/* 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)