From 0eb7ad36a1bd310cbe3ab676c9cbf4b1724bacd1 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Wed, 23 Oct 1996 17:20:31 -0400 Subject: [PATCH] (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 --- gcc/loop.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gcc/loop.c b/gcc/loop.c index b6ddb0b9723..ab20d99f3ee 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; -- 2.30.2