OSDN Git Service

(combine_givs): When combining a DEST_REG giv with its only use,
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Oct 1996 21:20:31 +0000 (21:20 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Oct 1996 21:20:31 +0000 (21:20 +0000)
always set the benefit of the combined giv to that of the DEST_REG giv.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13012 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/loop.c

index b6ddb0b..ab20d99 100644 (file)
@@ -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;