aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-10-23 17:20:31 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1996-10-23 17:20:31 -0400
commit0eb7ad36a1bd310cbe3ab676c9cbf4b1724bacd1 (patch)
tree2a5429270353627090e2f74585b00d30a7e55bea
parenta80586cc2a2c1f718c38dbe38e38b18b5b5469bf (diff)
downloadgcc-0eb7ad36a1bd310cbe3ab676c9cbf4b1724bacd1.zip
gcc-0eb7ad36a1bd310cbe3ab676c9cbf4b1724bacd1.tar.gz
gcc-0eb7ad36a1bd310cbe3ab676c9cbf4b1724bacd1.tar.bz2
(combine_givs): When combining a DEST_REG giv with its only use,
always set the benefit of the combined giv to that of the DEST_REG giv. From-SVN: r13012
-rw-r--r--gcc/loop.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index b6ddb0b..ab20d99f 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -5682,14 +5682,17 @@ combine_givs (bl)
g1->combined_with = 1;
/* 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))))
+ once, by the other giv, this is actually a single use.
+ The DEST_REG has the correct cost, while the other giv
+ counts the REG use too often. */
+ if (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;
+ else if (g1->giv_type != DEST_REG
+ || n_times_used[REGNO (g1->dest_reg)] != 1
+ || ! reg_mentioned_p (g1->dest_reg,
+ PATTERN (g2->insn)))
{
g1->benefit += g2->benefit;
g1->times_used += g2->times_used;