diff mbox

Fix -fcrossjumping at -O1 (PR rtl-optimization/48156)

Message ID 20110320124410.GO30899@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek March 20, 2011, 12:44 p.m. UTC
On Sat, Mar 19, 2011 at 09:42:26AM -0400, Kenneth Zadeck wrote:
> i think that this is the right way to go.    my view is not just
> what the code currently does, but also from the perspective of the
> way i want this to work as the back ends evolve.

Here is the updated patch, bootstrapped/regtested on x86_64-linux and
i686-linux.  Ok for trunk?

2011-03-20  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/48156
	* df-core.c (df_get_bb_dirty): Use df_lr if df_live is NULL,
	assume df and df_lr are not NULL.

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


	Jakub

Comments

Kenneth Zadeck March 20, 2011, 1:26 p.m. UTC | #1
yes

On 03/20/2011 08:44 AM, Jakub Jelinek wrote:
> On Sat, Mar 19, 2011 at 09:42:26AM -0400, Kenneth Zadeck wrote:
>> i think that this is the right way to go.    my view is not just
>> what the code currently does, but also from the perspective of the
>> way i want this to work as the back ends evolve.
> Here is the updated patch, bootstrapped/regtested on x86_64-linux and
> i686-linux.  Ok for trunk?
>
> 2011-03-20  Jakub Jelinek<jakub@redhat.com>
>
> 	PR rtl-optimization/48156
> 	* df-core.c (df_get_bb_dirty): Use df_lr if df_live is NULL,
> 	assume df and df_lr are not NULL.
>
> 	* gcc.dg/pr48156.c: New test.
>
> --- gcc/df-core.c.jj	2010-12-14 08:11:39.000000000 +0100
> +++ gcc/df-core.c	2011-03-19 16:09:53.000000000 +0100
> @@ -1400,10 +1400,9 @@ df_mark_solutions_dirty (void)
>   bool
>   df_get_bb_dirty (basic_block bb)
>   {
> -  if (df&&  df_live)
> -    return bitmap_bit_p (df_live->out_of_date_transfer_functions, bb->index);
> -  else
> -    return false;
> +  return bitmap_bit_p ((df_live
> +			? df_live : df_lr)->out_of_date_transfer_functions,
> +		       bb->index);
>   }
>
>
> --- gcc/testsuite/gcc.dg/pr48156.c.jj	2011-03-18 14:57:34.000000000 +0100
> +++ gcc/testsuite/gcc.dg/pr48156.c	2011-03-18 14:57:14.000000000 +0100
> @@ -0,0 +1,45 @@
> +/* PR rtl-optimization/48156 */
> +/* { dg-do run } */
> +/* { dg-options "-O -fcrossjumping --param min-crossjump-insns=1" } */
> +
> +extern void abort (void);
> +
> +static int __attribute__ ((noinline, noclone))
> +equals (int s1, int s2)
> +{
> +  return s1 == s2;
> +}
> +
> +static int __attribute__ ((noinline, noclone))
> +bar (void)
> +{
> +  return 1;
> +}
> +
> +static void __attribute__ ((noinline, noclone))
> +baz (int f, int j)
> +{
> +  if (f != 4 || j != 2)
> +    abort ();
> +}
> +
> +void
> +foo (int x)
> +{
> +  int i = 0, j = bar ();
> +
> +  if (x == 1)
> +    i = 2;
> +
> +  if (j&&  equals (i, j))
> +    baz (8, i);
> +  else
> +    baz (4, i);
> +}
> +
> +int
> +main ()
> +{
> +  foo (1);
> +  return 0;
> +}
>
> 	Jakub
diff mbox

Patch

--- gcc/df-core.c.jj	2010-12-14 08:11:39.000000000 +0100
+++ gcc/df-core.c	2011-03-19 16:09:53.000000000 +0100
@@ -1400,10 +1400,9 @@  df_mark_solutions_dirty (void)
 bool
 df_get_bb_dirty (basic_block bb)
 {
-  if (df && df_live)
-    return bitmap_bit_p (df_live->out_of_date_transfer_functions, bb->index);
-  else
-    return false;
+  return bitmap_bit_p ((df_live
+			? df_live : df_lr)->out_of_date_transfer_functions,
+		       bb->index);
 }
 
 
--- gcc/testsuite/gcc.dg/pr48156.c.jj	2011-03-18 14:57:34.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr48156.c	2011-03-18 14:57:14.000000000 +0100
@@ -0,0 +1,45 @@ 
+/* PR rtl-optimization/48156 */
+/* { dg-do run } */
+/* { dg-options "-O -fcrossjumping --param min-crossjump-insns=1" } */
+
+extern void abort (void);
+
+static int __attribute__ ((noinline, noclone))
+equals (int s1, int s2)
+{
+  return s1 == s2;
+}
+
+static int __attribute__ ((noinline, noclone))
+bar (void)
+{
+  return 1;
+}
+
+static void __attribute__ ((noinline, noclone))
+baz (int f, int j)
+{
+  if (f != 4 || j != 2)
+    abort ();
+}
+
+void
+foo (int x)
+{
+  int i = 0, j = bar ();
+
+  if (x == 1)
+    i = 2;
+
+  if (j && equals (i, j))
+    baz (8, i);
+  else
+    baz (4, i);
+}
+
+int
+main ()
+{
+  foo (1);
+  return 0;
+}