Patchwork Fix reginfo -fcompare-debug issue (PR debug/46771)

login
register
mail settings
Submitter Jakub Jelinek
Date Dec. 6, 2010, 5:54 p.m.
Message ID <20101206175405.GS29412@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/74445/
State New
Headers show

Comments

Jakub Jelinek - Dec. 6, 2010, 5:54 p.m.
Hi!

On the testcase below pseudo 104 is given SSE_REGS class without -g but
NO_REGS class with -g.  The reason for that is that reginfo says SSE_REGS
can't be used because there is a subreg incompatible with that class.
That subreg is really present, but only in a DEBUG_INSN, so it should be
disregarded.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok
for trunk?

2010-12-06  Jakub Jelinek  <jakub@redhat.com>

	PR debug/46771
	* reginfo.c (init_subregs_of_mode): Don't call find_subregs_of_mode
	on DEBUG_INSNs.

	* gcc.dg/pr46771.c: New test.


	Jakub
Jeff Law - Dec. 6, 2010, 7:11 p.m.
On 12/06/10 10:54, Jakub Jelinek wrote:
> Hi!
>
> On the testcase below pseudo 104 is given SSE_REGS class without -g but
> NO_REGS class with -g.  The reason for that is that reginfo says SSE_REGS
> can't be used because there is a subreg incompatible with that class.
> That subreg is really present, but only in a DEBUG_INSN, so it should be
> disregarded.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok
> for trunk?
>
> 2010-12-06  Jakub Jelinek<jakub@redhat.com>
>
> 	PR debug/46771
> 	* reginfo.c (init_subregs_of_mode): Don't call find_subregs_of_mode
> 	on DEBUG_INSNs.
>
> 	* gcc.dg/pr46771.c: New test.
OK.
jeff

Patch

--- gcc/reginfo.c.jj	2010-12-02 11:51:32.000000000 +0100
+++ gcc/reginfo.c	2010-12-06 08:59:20.000000000 +0100
@@ -1330,7 +1330,7 @@  init_subregs_of_mode (void)
 
   FOR_EACH_BB (bb)
     FOR_BB_INSNS (bb, insn)
-    if (INSN_P (insn))
+    if (NONDEBUG_INSN_P (insn))
       find_subregs_of_mode (PATTERN (insn));
 }
 
--- gcc/testsuite/gcc.dg/pr46771.c.jj	2010-12-06 09:02:12.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr46771.c	2010-12-06 09:01:57.000000000 +0100
@@ -0,0 +1,18 @@ 
+/* PR debug/46771 */
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize -fcompare-debug" } */
+
+unsigned char v[1600];
+
+unsigned char
+foo (unsigned char x)
+{
+  int i;
+  unsigned char a = x;
+  unsigned char b = x;
+  for (i = 0; i < 1600; i++)
+    a = a < v[i] ? v[i] : a;
+  for (i = 0; i < 1600; i++)
+    b = b > v[i] ? v[i] : b;
+  return a - b;
+}