i386.c (distance_agu_use_in_bb): Proper initialization of 'prev' var to get better...
authorYuri Rumyantsev <ysrumyan@gmail.com>
Tue, 17 Sep 2013 12:01:28 +0000 (12:01 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Tue, 17 Sep 2013 12:01:28 +0000 (12:01 +0000)
* config/i386/i386.c (distance_agu_use_in_bb) : Proper initialization
  of 'prev' var to get better distance estimation.

From-SVN: r202649

gcc/ChangeLog
gcc/config/i386/i386.c

index 44c7d66134a5275b8e59c4193d48744389393276..e05412a2dab5d8d0634aabd68afba2f2bc0cd71f 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-17  Yuri Rumyantsev  <ysrumyan@gmail.com>
+
+       * config/i386/i386.c (distance_agu_use_in_bb) : Proper initialization
+       of 'prev' var to get better distance estimation.
+
 2013-09-17  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree-inline.h (struct copy_body_data): Add transform_parameter.
index bba214712a052cc0d4286c58c8827c61ea32c0dd..ac7d40ae3928bd08bc394992612f4f871852a989 100644 (file)
@@ -17469,13 +17469,23 @@ distance_agu_use_in_bb (unsigned int regno,
                        rtx insn, int distance, rtx start,
                        bool *found, bool *redefined)
 {
-  basic_block bb = start ? BLOCK_FOR_INSN (start) : NULL;
+  basic_block bb = NULL;
   rtx next = start;
   rtx prev = NULL;
 
   *found = false;
   *redefined = false;
 
+  if (start != NULL_RTX)
+    {
+      bb = BLOCK_FOR_INSN (start);
+      if (start != BB_HEAD (bb))
+       /* If insn and start belong to the same bb, set prev to insn,
+          so the call to increase_distance will increase the distance
+          between insns by 1.  */
+       prev = insn;
+    }
+
   while (next
         && next != insn
         && distance < LEA_SEARCH_THRESHOLD)