From 59c52af442733519896c6cf71a57deb7e8791d1b Mon Sep 17 00:00:00 2001
From: Kenneth Zadeck <zadeck@naturalbridge.com>
Date: Fri, 20 Jan 2006 01:24:00 +0000
Subject: [PATCH] re PR rtl-optimization/25799 (cc1 stalled with -O1
 -fmodulo-sched)

2005-01-19  Kenneth Zadeck <zadeck@naturalbridge.com>

	PR rtl-optimization/25799
	* df-problems.c (df_ru_confluence_n, df_rd_confluence_n):
	Corrected confluence operator to remove bits from op2 before oring
	with op1 rather than removing bits from op1.
        * (df_ru_transfer_function): Corrected test on wrong bitmap which
	caused infinite loop.  Both of these problems were introduced in
	the dataflow rewrite.

From-SVN: r110007
---
 gcc/ChangeLog     | 10 ++++++++++
 gcc/df-problems.c | 22 +++++++++++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ff3ba408dc59..84006ab7f9cc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2005-01-19  Kenneth Zadeck <zadeck@naturalbridge.com>
+
+	PR rtl-optimization/25799 
+	* df-problems.c (df_ru_confluence_n, df_rd_confluence_n):
+	Corrected confluence operator to remove bits from op2 before oring
+	with op1 rather than removing bits from op1.
+        * (df_ru_transfer_function): Corrected test on wrong bitmap which
+	caused infinite loop.  Both of these problems were introduced in
+	the dataflow rewrite.
+
 2006-01-19  DJ Delorie  <dj@redhat.com>
 
 	* reload1.c (find_reload_regs): Note the details of reload
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 2a7ec0d0ed9f..790b3e244a1b 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -616,13 +616,19 @@ df_ru_confluence_n (struct dataflow *dflow, edge e)
       struct df *df = dflow->df;
       bitmap_iterator bi;
       unsigned int regno;
-      bitmap_ior_and_compl_into (op1, op2, dense_invalidated);
+      bitmap tmp = BITMAP_ALLOC (NULL);
+
+      bitmap_copy (tmp, op2);
+      bitmap_and_compl_into (tmp, dense_invalidated);
+
       EXECUTE_IF_SET_IN_BITMAP (sparse_invalidated, 0, regno, bi)
 	{
- 	  bitmap_clear_range (op1, 
+ 	  bitmap_clear_range (tmp, 
  			      DF_REG_USE_GET (df, regno)->begin, 
  			      DF_REG_USE_GET (df, regno)->n_refs);
 	}
+      bitmap_ior_into (op1, tmp);
+      BITMAP_FREE (tmp);
     }
   else
     bitmap_ior_into (op1, op2);
@@ -659,7 +665,7 @@ df_ru_transfer_function (struct dataflow *dflow, int bb_index)
 	}
       bitmap_and_compl_into (tmp, kill);
       bitmap_ior_into (tmp, gen);
-      changed = !bitmap_equal_p (tmp, out);
+      changed = !bitmap_equal_p (tmp, in);
       if (changed)
 	{
 	  BITMAP_FREE (out);
@@ -1097,13 +1103,19 @@ df_rd_confluence_n (struct dataflow *dflow, edge e)
       struct df *df = dflow->df;
       bitmap_iterator bi;
       unsigned int regno;
-      bitmap_ior_and_compl_into (op1, op2, dense_invalidated);
+      bitmap tmp = BITMAP_ALLOC (NULL);
+
+      bitmap_copy (tmp, op2);
+      bitmap_and_compl_into (tmp, dense_invalidated);
+
       EXECUTE_IF_SET_IN_BITMAP (sparse_invalidated, 0, regno, bi)
  	{
- 	  bitmap_clear_range (op1, 
+ 	  bitmap_clear_range (tmp, 
  			      DF_REG_DEF_GET (df, regno)->begin, 
  			      DF_REG_DEF_GET (df, regno)->n_refs);
 	}
+      bitmap_ior_into (op1, tmp);
+      BITMAP_FREE (tmp);
     }
   else
     bitmap_ior_into (op1, op2);
-- 
GitLab