aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2011-04-08 22:31:22 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-04-08 22:31:22 +0000
commit68bc509a5c4ee2c3179c9430ce9c50dc1f9bfad2 (patch)
tree4b379aed7743a6b37efaaade194c8751f93ca0f1 /gcc/combine.c
parent51a30b323dd59079cf039341d16e95c6136f31cb (diff)
downloadgcc-68bc509a5c4ee2c3179c9430ce9c50dc1f9bfad2.zip
gcc-68bc509a5c4ee2c3179c9430ce9c50dc1f9bfad2.tar.gz
gcc-68bc509a5c4ee2c3179c9430ce9c50dc1f9bfad2.tar.bz2
combine.c (combine_validate_cost): Adjust comments.
* combine.c (combine_validate_cost): Adjust comments. Set registered cost of I0 to zero at the end, if any. From-SVN: r172216
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 8771acf..32a3d73 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -789,14 +789,13 @@ do_SUBST_MODE (rtx *into, enum machine_mode newval)
#define SUBST_MODE(INTO, NEWVAL) do_SUBST_MODE(&(INTO), (NEWVAL))
-/* Subroutine of try_combine. Determine whether the combine replacement
- patterns NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to
- insn_rtx_cost that the original instruction sequence I0, I1, I2, I3 and
- undobuf.other_insn. Note that I1 and/or NEWI2PAT may be NULL_RTX.
- NEWOTHERPAT and undobuf.other_insn may also both be NULL_RTX. This
- function returns false, if the costs of all instructions can be
- estimated, and the replacements are more expensive than the original
- sequence. */
+/* Subroutine of try_combine. Determine whether the replacement patterns
+ NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to insn_rtx_cost
+ than the original sequence I0, I1, I2, I3 and undobuf.other_insn. Note
+ that I0, I1 and/or NEWI2PAT may be NULL_RTX. Similarly, NEWOTHERPAT and
+ undobuf.other_insn may also both be NULL_RTX. Return false if the cost
+ of all the instructions can be estimated and the replacements are more
+ expensive than the original sequence. */
static bool
combine_validate_cost (rtx i0, rtx i1, rtx i2, rtx i3, rtx newpat,
@@ -861,10 +860,9 @@ combine_validate_cost (rtx i0, rtx i1, rtx i2, rtx i3, rtx newpat,
old_cost = 0;
}
- /* Disallow this recombination if both new_cost and old_cost are
- greater than zero, and new_cost is greater than old cost. */
- if (old_cost > 0
- && new_cost > old_cost)
+ /* Disallow this combination if both new_cost and old_cost are greater than
+ zero, and new_cost is greater than old cost. */
+ if (old_cost > 0 && new_cost > old_cost)
{
if (dump_file)
{
@@ -910,7 +908,11 @@ combine_validate_cost (rtx i0, rtx i1, rtx i2, rtx i3, rtx newpat,
INSN_COST (i2) = new_i2_cost;
INSN_COST (i3) = new_i3_cost;
if (i1)
- INSN_COST (i1) = 0;
+ {
+ INSN_COST (i1) = 0;
+ if (i0)
+ INSN_COST (i0) = 0;
+ }
return true;
}