aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-09-22 11:12:06 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1996-09-22 11:12:06 -0400
commit410bd69891071449226b009b3e53d7fe82bc06f1 (patch)
tree95b6498cfbec1c71e9004ec509e0394bf612c806 /gcc
parent039f5fb1a88e320122a4120946f639fd0300d726 (diff)
downloadgcc-410bd69891071449226b009b3e53d7fe82bc06f1.zip
gcc-410bd69891071449226b009b3e53d7fe82bc06f1.tar.gz
gcc-410bd69891071449226b009b3e53d7fe82bc06f1.tar.bz2
(combine_givs): Improve combining DEST_REG giv with its only use.
From-SVN: r12769
Diffstat (limited to 'gcc')
-rw-r--r--gcc/loop.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index f4670fd..b3c49a4 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -1,5 +1,5 @@
/* Perform various loop optimizations, including strength reduction.
- Copyright (C) 1987, 88, 89, 91-4, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 89, 91-5, 1996 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -5672,14 +5672,26 @@ combine_givs (bl)
/* g2->new_reg set by `combine_givs_p' */
g2->same = g1;
g1->combined_with = 1;
- g1->benefit += g2->benefit;
+
+ /* If one of these givs is a DEST_REG that was only used
+ once, by the other giv, this is actually a single use. */
+ if ((g1->giv_type != DEST_REG
+ || n_times_used[REGNO (g1->dest_reg)] != 1
+ || ! reg_mentioned_p (g1->dest_reg, PATTERN (g2->insn)))
+ && (g2->giv_type != DEST_REG
+ || n_times_used[REGNO (g2->dest_reg)] != 1
+ || ! reg_mentioned_p (g2->dest_reg,
+ PATTERN (g1->insn))))
+ {
+ g1->benefit += g2->benefit;
+ g1->times_used += g2->times_used;
+ }
/* ??? The new final_[bg]iv_value code does a much better job
of finding replaceable giv's, and hence this code may no
longer be necessary. */
if (! g2->replaceable && REG_USERVAR_P (g2->dest_reg))
g1->benefit -= copy_cost;
g1->lifetime += g2->lifetime;
- g1->times_used += g2->times_used;
if (loop_dump_stream)
fprintf (loop_dump_stream, "giv at %d combined with giv at %d\n",