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 up ipa-prop caused -fcompare-debug failures (PR ipa/59722)


Hi!

The recent ipa_analyze_params_uses changes broke i686-linux bootstrap
with --enable-checking=release, the reduced testcase below shows it.
Obviously we need to ignore debug stmt uses during analysis.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk as
obvious.

2014-01-08  Jakub Jelinek  <jakub@redhat.com>

	PR ipa/59722
	* ipa-prop.c (ipa_analyze_params_uses): Ignore uses in debug stmts.

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

--- gcc/ipa-prop.c.jj	2014-01-06 22:32:17.101586391 +0100
+++ gcc/ipa-prop.c	2014-01-08 16:07:29.203641224 +0100
@@ -2127,8 +2127,11 @@ ipa_analyze_params_uses (struct cgraph_n
 	      FOR_EACH_IMM_USE_FAST (use_p, imm_iter, ddef)
 		if (!is_gimple_call (USE_STMT (use_p)))
 		  {
-		    controlled_uses = IPA_UNDESCRIBED_USE;
-		    break;
+		    if (!is_gimple_debug (USE_STMT (use_p)))
+		      {
+			controlled_uses = IPA_UNDESCRIBED_USE;
+			break;
+		      }
 		  }
 		else
 		  controlled_uses++;
--- gcc/testsuite/gcc.dg/pr59722.c.jj	2014-01-08 16:06:34.325960016 +0100
+++ gcc/testsuite/gcc.dg/pr59722.c	2014-01-08 16:06:03.000000000 +0100
@@ -0,0 +1,36 @@
+/* PR ipa/59722 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+extern void abrt (const char *, int) __attribute__((noreturn));
+void baz (int *, int *);
+
+static inline int
+bar (void)
+{
+  return 1;
+}
+
+static inline void
+foo (int *x, int y (void))
+{
+  while (1)
+    {
+      int a = 0;
+      if (*x)
+	{
+	  baz (x, &a);
+	  while (a && !y ())
+	    ;
+	  break;
+	}
+      abrt ("", 1);
+    }
+}
+
+void
+test (int x)
+{
+  foo (&x, bar);
+  foo (&x, bar);
+}

	Jakub


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