From 718d3588b02c5fde3939e889c7586d71a99c4629 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebastian.pop@amd.com>
Date: Wed, 2 Jun 2010 16:39:37 +0000
Subject: [PATCH] Only reset the GIMPLE_DEBUG information in the code gen of
 if-conversion.

2010-06-02  Sebastian Pop  <sebastian.pop@amd.com>

	* tree-if-conv.c (predicate_bbs): Do not reset the GIMPLE_DEBUG
	information.
	(remove_conditions_and_labels): Reset the GIMPLE_DEBUG information.

From-SVN: r160164
---
 gcc/ChangeLog      |  6 ++++++
 gcc/tree-if-conv.c | 36 ++++++++++++++++++++++--------------
 2 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d64804d359b8..de6cb5b76eb6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2010-06-02  Sebastian Pop  <sebastian.pop@amd.com>
+
+	* tree-if-conv.c (predicate_bbs): Do not reset the GIMPLE_DEBUG
+	information.
+	(remove_conditions_and_labels): Reset the GIMPLE_DEBUG information.
+
 2010-06-02  Sebastian Pop  <sebastian.pop@amd.com>
 
 	PR middle-end/44363
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index f6e8c969dc1f..25cb91837398 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -509,15 +509,7 @@ predicate_bbs (loop_p loop)
 	    case GIMPLE_LABEL:
 	    case GIMPLE_ASSIGN:
 	    case GIMPLE_CALL:
-	      break;
-
 	    case GIMPLE_DEBUG:
-	      /* ??? Should there be conditional GIMPLE_DEBUG_BINDs?  */
-	      if (gimple_debug_bind_p (gsi_stmt (itr)))
-		{
-		  gimple_debug_bind_reset_value (gsi_stmt (itr));
-		  update_stmt (gsi_stmt (itr));
-		}
 	      break;
 
 	    case GIMPLE_COND:
@@ -900,7 +892,8 @@ process_phi_nodes (struct loop *loop)
 }
 
 /* Remove all GIMPLE_CONDs and GIMPLE_LABELs of all the basic blocks
-   other than the exit and latch of the LOOP.  */
+   other than the exit and latch of the LOOP.  Also resets the
+   GIMPLE_DEBUG information.  */
 
 static void
 remove_conditions_and_labels (loop_p loop)
@@ -917,11 +910,26 @@ remove_conditions_and_labels (loop_p loop)
       continue;
 
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
-      if (gimple_code (gsi_stmt (gsi)) == GIMPLE_COND
-          || gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
-        gsi_remove (&gsi, true);
-      else
-        gsi_next (&gsi);
+	switch (gimple_code (gsi_stmt (gsi)))
+	  {
+	  case GIMPLE_COND:
+	  case GIMPLE_LABEL:
+	    gsi_remove (&gsi, true);
+	    break;
+
+	  case GIMPLE_DEBUG:
+	    /* ??? Should there be conditional GIMPLE_DEBUG_BINDs?  */
+	    if (gimple_debug_bind_p (gsi_stmt (gsi)))
+	      {
+		gimple_debug_bind_reset_value (gsi_stmt (gsi));
+		update_stmt (gsi_stmt (gsi));
+	      }
+	    gsi_next (&gsi);
+	    break;
+
+	  default:
+	    gsi_next (&gsi);
+	  }
     }
 }
 
-- 
GitLab