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]

[PATCH] Fix -fcompare-debug issue with -fsched-pressure (PR debug/44178)


Hi!

The attached testcase fails with -fcompare-debug.  The problem is that
setup_ref_regs is called even on DEBUG_INSNs, which means if some pseudo
is only referenced in a DEBUG_INSN and nowhere else in some basic block
there are differences in -fsched-pressure decisions between -g and -g0.

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

2010-05-20  Jakub Jelinek  <jakub@redhat.com>

	PR debug/44178
	* haifa-sched.c (initiate_bb_reg_pressure_info): Do not call
	setup_ref_regs for DEBUG_INSNs.

	* g++.dg/debug/pr44178.C: New test.

--- gcc/haifa-sched.c.jj	2010-05-13 10:39:21.000000000 +0200
+++ gcc/haifa-sched.c	2010-05-19 15:36:22.000000000 +0200
@@ -718,7 +718,7 @@ initiate_bb_reg_pressure_info (basic_blo
 
   if (current_nr_blocks > 1)
     FOR_BB_INSNS (bb, insn)
-      if (INSN_P (insn))
+      if (NONDEBUG_INSN_P (insn))
 	setup_ref_regs (PATTERN (insn));
   initiate_reg_pressure_info (df_get_live_in (bb));
 #ifdef EH_RETURN_DATA_REGNO
--- gcc/testsuite/g++.dg/debug/pr44178.C.jj	2010-05-19 15:42:56.000000000 +0200
+++ gcc/testsuite/g++.dg/debug/pr44178.C	2010-05-19 15:42:41.000000000 +0200
@@ -0,0 +1,39 @@
+// PR debug/44178
+// { dg-do compile }
+// { dg-options "-funroll-loops -fcompare-debug" { target i?86-*-* x86_64-*-* } }
+// { dg-options "-fsched-pressure -funroll-loops -fschedule-insns -fcompare-debug" { target i?86-*-* x86_64-*-* } }
+
+struct A
+{
+  A ();
+  A (const A &) {}
+  A &operator = (const A &);
+};
+
+struct B
+{
+  int u1;
+  A u2;
+  int u3;
+  int i;
+};
+
+B f1 (int *);
+B f2 (int, int, int, int);
+B f3 (B *, B *);
+
+B
+f4 (int x, int y, int z)
+{
+  B b1, b2;
+  for (int i = x; i > 0; i--)
+    for (int j = y; j > 0; j--)
+      {
+	int k;
+	f1 (&k);
+	b2 = f2 (i, 0, 0, z);
+	if (b2.i) return b2;
+	f3 (&b1, &b2);
+      }
+  return b1;
+}

	Jakub


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