This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PR 42629] disregard debug insns in register pressure computations


-fsched-pressure counted uses in debug insns for purposes of register
pressure computation, leading to -fcompare-debug failures.  This trivial
patch fixes it.  I'll give it a round of testing just to follow
procedure, and I'd check it in as obvious if it wasn't for the testcase.
I'd like approval to put it in, because although small, it's most likely
copied from somewhere else.

for  gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/42629
	* haifa-sched.c (dying_use_p): Debug insns don't count.

for  gcc/testsuite/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/42629
	* gcc.dg/pr42629.c: New.

Index: gcc/haifa-sched.c
===================================================================
--- gcc/haifa-sched.c.orig	2010-01-07 11:12:02.000000000 -0200
+++ gcc/haifa-sched.c	2010-01-07 11:14:10.000000000 -0200
@@ -1,6 +1,6 @@
 /* Instruction scheduling pass.
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
    and currently maintained by, Jim Wilson (wilson@cygnus.com)
@@ -766,7 +766,8 @@ dying_use_p (struct reg_use_data *use)
   struct reg_use_data *next;
 
   for (next = use->next_regno_use; next != use; next = next->next_regno_use)
-    if (QUEUE_INDEX (next->insn) != QUEUE_SCHEDULED)
+    if (NONDEBUG_INSN_P (next->insn)
+	&& QUEUE_INDEX (next->insn) != QUEUE_SCHEDULED)
       return false;
   return true;
 }
Index: gcc/testsuite/gcc.dg/pr42629.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.dg/pr42629.c	2010-01-07 11:21:27.000000000 -0200
@@ -0,0 +1,27 @@
+/* This failed -fcompare-debug because register pressure computation
+   took debug insns into account.  */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fsched-pressure -fschedule-insns -fcompare-debug" } */
+
+int lzo_adler32(int adler, char *buf)
+{
+  int s1 = adler;
+  int s2 = adler;
+  s1 += buf[0];
+  s2 += s1;
+  s1 += buf[1];
+  s2 += s1;
+  s1 += buf[2];
+  s2 += s1;
+  s1 += buf[3];
+  s2 += s1;
+  s1 += buf[4];
+  s2 += s1;
+  s1 += buf[5];
+  s2 += s1;
+  s1 += buf[6];
+  s2 += s1;
+  s1 += buf[7];
+  s2 += s1;
+  return (s2 << 16) + s1;
+}

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]