tree-ssa-forwprop.c (forward_propagate_into_cond): Avoid typo potentially leading to null pointer dereference.

* tree-ssa-forwprop.c (forward_propagate_into_cond): Avoid 
	typo potentially leading to null pointer dereference.

	* caller-save.c (new_saved_hard_reg): Eliminate return value.
	(setup_save_areas): Corresponding changes to avoid useless
	assignments.

	* jump.c (reversed_comparison_code_parts): Avoid successive return
	statements when REVERSE_CONDITION is defined.

	* expr.c (expand_assignment): Avoid useless assignments.
	(expand_expr_real_1): Likewise.
	(expand_expr_real_2): Avoid useless statements.

	* tree-ssa-phiopt.c (minmax_replacement): Avoid useless statement.

	* cfgexpand.c (expand_gimple_basic_block): Avoid useless assignment.

	* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Avoid useless
	statements.

	* stmt.c (expand_expr_stmt): Avoid useless assignment.

From-SVN: r171780
This commit is contained in:
Jeff Law 2011-03-31 07:28:29 -06:00 committed by Jeff Law
parent eb1eb91413
commit e16b6fd0f7
9 changed files with 36 additions and 24 deletions

View file

@ -1,3 +1,28 @@
2011-03-31 Jeff Law <law@redhat.com>
* tree-ssa-forwprop.c (forward_propagate_into_cond): Avoid
typo potentially leading to null pointer dereference.
* caller-save.c (new_saved_hard_reg): Eliminate return value.
(setup_save_areas): Corresponding changes to avoid useless
assignments.
* jump.c (reversed_comparison_code_parts): Avoid successive return
statements when REVERSE_CONDITION is defined.
* expr.c (expand_assignment): Avoid useless assignments.
(expand_expr_real_1): Likewise.
(expand_expr_real_2): Avoid useless statements.
* tree-ssa-phiopt.c (minmax_replacement): Avoid useless statement.
* cfgexpand.c (expand_gimple_basic_block): Avoid useless assignment.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Avoid useless
statements.
* stmt.c (expand_expr_stmt): Avoid useless assignment.
2011-03-31 Joseph Myers <joseph@codesourcery.com> 2011-03-31 Joseph Myers <joseph@codesourcery.com>
PR target/47109 PR target/47109

View file

@ -82,7 +82,7 @@ static int reg_restore_code (int, enum machine_mode);
struct saved_hard_reg; struct saved_hard_reg;
static void initiate_saved_hard_regs (void); static void initiate_saved_hard_regs (void);
static struct saved_hard_reg *new_saved_hard_reg (int, int); static void new_saved_hard_reg (int, int);
static void finish_saved_hard_regs (void); static void finish_saved_hard_regs (void);
static int saved_hard_reg_compare_func (const void *, const void *); static int saved_hard_reg_compare_func (const void *, const void *);
@ -346,7 +346,7 @@ initiate_saved_hard_regs (void)
/* Allocate and return new saved hard register with given REGNO and /* Allocate and return new saved hard register with given REGNO and
CALL_FREQ. */ CALL_FREQ. */
static struct saved_hard_reg * static void
new_saved_hard_reg (int regno, int call_freq) new_saved_hard_reg (int regno, int call_freq)
{ {
struct saved_hard_reg *saved_reg; struct saved_hard_reg *saved_reg;
@ -359,7 +359,6 @@ new_saved_hard_reg (int regno, int call_freq)
saved_reg->call_freq = call_freq; saved_reg->call_freq = call_freq;
saved_reg->first_p = FALSE; saved_reg->first_p = FALSE;
saved_reg->next = -1; saved_reg->next = -1;
return saved_reg;
} }
/* Free memory allocated for the saved hard registers. */ /* Free memory allocated for the saved hard registers. */
@ -463,7 +462,7 @@ setup_save_areas (void)
if (hard_reg_map[regno] != NULL) if (hard_reg_map[regno] != NULL)
hard_reg_map[regno]->call_freq += freq; hard_reg_map[regno]->call_freq += freq;
else else
saved_reg = new_saved_hard_reg (regno, freq); new_saved_hard_reg (regno, freq);
SET_HARD_REG_BIT (hard_regs_used, regno); SET_HARD_REG_BIT (hard_regs_used, regno);
} }
/* Look through all live pseudos, mark their hard registers. */ /* Look through all live pseudos, mark their hard registers. */
@ -483,7 +482,7 @@ setup_save_areas (void)
if (hard_reg_map[r] != NULL) if (hard_reg_map[r] != NULL)
hard_reg_map[r]->call_freq += freq; hard_reg_map[r]->call_freq += freq;
else else
saved_reg = new_saved_hard_reg (r, freq); new_saved_hard_reg (r, freq);
SET_HARD_REG_BIT (hard_regs_to_save, r); SET_HARD_REG_BIT (hard_regs_to_save, r);
SET_HARD_REG_BIT (hard_regs_used, r); SET_HARD_REG_BIT (hard_regs_used, r);
} }

View file

@ -3576,7 +3576,7 @@ expand_gimple_basic_block (basic_block bb)
val = gen_rtx_VAR_LOCATION val = gen_rtx_VAR_LOCATION
(mode, var, (rtx)value, VAR_INIT_STATUS_INITIALIZED); (mode, var, (rtx)value, VAR_INIT_STATUS_INITIALIZED);
val = emit_debug_insn (val); emit_debug_insn (val);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {

View file

@ -4124,7 +4124,7 @@ expand_assignment (tree to, tree from, bool nontemporal)
/* Don't crash if the lhs of the assignment was erroneous. */ /* Don't crash if the lhs of the assignment was erroneous. */
if (TREE_CODE (to) == ERROR_MARK) if (TREE_CODE (to) == ERROR_MARK)
{ {
result = expand_normal (from); expand_normal (from);
return; return;
} }
@ -8170,7 +8170,6 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
case VEC_UNPACK_LO_EXPR: case VEC_UNPACK_LO_EXPR:
{ {
op0 = expand_normal (treeop0); op0 = expand_normal (treeop0);
this_optab = optab_for_tree_code (code, type, optab_default);
temp = expand_widen_pattern_expr (ops, op0, NULL_RTX, NULL_RTX, temp = expand_widen_pattern_expr (ops, op0, NULL_RTX, NULL_RTX,
target, unsignedp); target, unsignedp);
gcc_assert (temp); gcc_assert (temp);
@ -8182,9 +8181,6 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
{ {
op0 = expand_normal (treeop0); op0 = expand_normal (treeop0);
/* The signedness is determined from input operand. */ /* The signedness is determined from input operand. */
this_optab = optab_for_tree_code (code,
TREE_TYPE (treeop0),
optab_default);
temp = expand_widen_pattern_expr temp = expand_widen_pattern_expr
(ops, op0, NULL_RTX, NULL_RTX, (ops, op0, NULL_RTX, NULL_RTX,
target, TYPE_UNSIGNED (TREE_TYPE (treeop0))); target, TYPE_UNSIGNED (TREE_TYPE (treeop0)));
@ -8334,7 +8330,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
{ {
temp = expand_expr (exp, NULL_RTX, VOIDmode, modifier); temp = expand_expr (exp, NULL_RTX, VOIDmode, modifier);
if (MEM_P (temp)) if (MEM_P (temp))
temp = copy_to_reg (temp); copy_to_reg (temp);
return const0_rtx; return const0_rtx;
} }

View file

@ -308,8 +308,9 @@ reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0,
{ {
#ifdef REVERSE_CONDITION #ifdef REVERSE_CONDITION
return REVERSE_CONDITION (code, mode); return REVERSE_CONDITION (code, mode);
#endif #else
return reverse_condition (code); return reverse_condition (code);
#endif
} }
/* Try a few special cases based on the comparison code. */ /* Try a few special cases based on the comparison code. */

View file

@ -1455,7 +1455,7 @@ expand_expr_stmt (tree exp)
if (TYPE_MODE (type) == VOIDmode) if (TYPE_MODE (type) == VOIDmode)
; ;
else if (TYPE_MODE (type) != BLKmode) else if (TYPE_MODE (type) != BLKmode)
value = copy_to_reg (value); copy_to_reg (value);
else else
{ {
rtx lab = gen_label_rtx (); rtx lab = gen_label_rtx ();

View file

@ -271,8 +271,6 @@ mark_operand_necessary (tree op)
static void static void
mark_stmt_if_obviously_necessary (gimple stmt, bool aggressive) mark_stmt_if_obviously_necessary (gimple stmt, bool aggressive)
{ {
tree lhs = NULL_TREE;
/* With non-call exceptions, we have to assume that all statements could /* With non-call exceptions, we have to assume that all statements could
throw. If a statement may throw, it is inherently necessary. */ throw. If a statement may throw, it is inherently necessary. */
if (cfun->can_throw_non_call_exceptions && stmt_could_throw_p (stmt)) if (cfun->can_throw_non_call_exceptions && stmt_could_throw_p (stmt))
@ -311,12 +309,6 @@ mark_stmt_if_obviously_necessary (gimple stmt, bool aggressive)
} }
if (!gimple_call_lhs (stmt)) if (!gimple_call_lhs (stmt))
return; return;
lhs = gimple_call_lhs (stmt);
/* Fall through */
case GIMPLE_ASSIGN:
if (!lhs)
lhs = gimple_assign_lhs (stmt);
break; break;
case GIMPLE_DEBUG: case GIMPLE_DEBUG:

View file

@ -553,7 +553,7 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
{ {
name = cond; name = cond;
def_stmt = get_prop_source_stmt (name, true, NULL); def_stmt = get_prop_source_stmt (name, true, NULL);
if (def_stmt || !can_propagate_from (def_stmt)) if (!def_stmt || !can_propagate_from (def_stmt))
return did_something; return did_something;
rhs0 = gimple_assign_rhs1 (def_stmt); rhs0 = gimple_assign_rhs1 (def_stmt);

View file

@ -695,7 +695,6 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
cond = last_stmt (cond_bb); cond = last_stmt (cond_bb);
cmp = gimple_cond_code (cond); cmp = gimple_cond_code (cond);
result = PHI_RESULT (phi);
/* This transformation is only valid for order comparisons. Record which /* This transformation is only valid for order comparisons. Record which
operand is smaller/larger if the result of the comparison is true. */ operand is smaller/larger if the result of the comparison is true. */