From 417a43d75bf1c369325af6ee4367f7838c3573bd Mon Sep 17 00:00:00 2001
From: krebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 8 Feb 2011 11:15:53 +0000
Subject: [PATCH] 2011-02-08  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	* gimple-low.c (lower_function_body): Don't remove the location of
	the return statement here.
	(lower_gimple_return): Do it here instead but only if the return
	statement is actually used twice.




git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169918 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog    |  7 +++++++
 gcc/gimple-low.c | 14 ++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c4853269f16..36e7a731040 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2011-02-08  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+	* gimple-low.c (lower_function_body): Don't remove the location of
+	the return statement here.
+	(lower_gimple_return): Do it here instead but only if the return
+	statement is actually used twice.
+
 2011-02-08  Richard Guenther  <rguenther@suse.de>
 
 	PR tree-optimization/47632
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 4e492414290..67087a0aadc 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -148,11 +148,6 @@ lower_function_body (void)
 
       x = gimple_build_label (t.label);
       gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
-
-      /* Remove the line number from the representative return statement.
-	 It now fills in for many such returns.  Failure to remove this
-	 will result in incorrect results for coverage analysis.  */
-      gimple_set_location (t.stmt, UNKNOWN_LOCATION);
       gsi_insert_after (&i, t.stmt, GSI_CONTINUE_LINKING);
     }
 
@@ -746,7 +741,14 @@ lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
       tmp_rs = *VEC_index (return_statements_t, data->return_statements, i);
 
       if (gimple_return_retval (stmt) == gimple_return_retval (tmp_rs.stmt))
-	goto found;
+	{
+	  /* Remove the line number from the representative return statement.
+	     It now fills in for many such returns.  Failure to remove this
+	     will result in incorrect results for coverage analysis.  */
+	  gimple_set_location (tmp_rs.stmt, UNKNOWN_LOCATION);
+
+	  goto found;
+	}
     }
 
   /* Not found.  Create a new label and record the return statement.  */
-- 
GitLab