diff mbox

When making var non-addressable, drop var ={v} {CLOBBER} stmts (PR debug/50317)

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

Commit Message

Jakub Jelinek Nov. 28, 2011, 6:43 p.m. UTC
Hi!

As discussed in the PR, SSA_NAME ={v} {CLOBBER} stmts are undesirable
at least for the debug info, we really don't need to mark there the end
of scope in the IL, the debug info records the ranges of the scopes
and if the clobber gets scheduled before some insn we get unnecessarily
pessimistic debug info.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

2011-11-28  Jakub Jelinek  <jakub@redhat.com>

	PR debug/50317
	* tree-ssa.c (execute_update_addresses_taken): Remove
	var ={v} {CLOBBER} stmts instead of rewriting them into
	var_N ={v} {CLOBBER}.


	Jakub

Comments

Jeff Law Nov. 28, 2011, 7:11 p.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/28/11 11:43, Jakub Jelinek wrote:
> Hi!
> 
> As discussed in the PR, SSA_NAME ={v} {CLOBBER} stmts are 
> undesirable at least for the debug info, we really don't need to 
> mark there the end of scope in the IL, the debug info records the 
> ranges of the scopes and if the clobber gets scheduled before some
>  insn we get unnecessarily pessimistic debug info.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and 
> i686-linux, ok for trunk?
> 
> 2011-11-28  Jakub Jelinek  <jakub@redhat.com>
> 
> PR debug/50317 * tree-ssa.c (execute_update_addresses_taken): 
> Remove var ={v} {CLOBBER} stmts instead of rewriting them into 
> var_N ={v} {CLOBBER}.
OK.
jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJO09zqAAoJEBRtltQi2kC7d8EH/AuX8rrnT1rxF3Umy7DWMFuV
yMjG/J0O+60KOjUtDW6p8cbXMdN7Qibxy23fTq3mRaVTcqnPuV2v3D9QKmeUvyrs
tBlyr0m0yg8UCJYPOeROvHdoCWZMlzGfTDMCluom7aTHgPwtBjTdtlJ/KHiWuTTr
PALxecYYFBWKtkQC2Em+y0Ye41I9G7BXQOYbAm1Bv3NDB7lAaBdy27/rBd1ExVzG
7XdI/oYFBuR+IkUwvepiCpJYVbAIpRJBAZwvQJh/dazKZ3CC37VYh8GGHm0XwE6v
QofULrke83QnnCmGnTRElczP1uHRV2HmjY6P2lDCQGjfBImIOgEyIg0+TKjNhG4=
=gzoS
-----END PGP SIGNATURE-----
diff mbox

Patch

--- gcc/tree-ssa.c.jj	2011-10-14 08:21:56.000000000 +0200
+++ gcc/tree-ssa.c	2011-11-28 13:29:45.297956952 +0100
@@ -2118,7 +2118,7 @@  execute_update_addresses_taken (void)
   if (update_vops)
     {
       FOR_EACH_BB (bb)
-	for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+	for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
 	  {
 	    gimple stmt = gsi_stmt (gsi);
 
@@ -2159,6 +2159,18 @@  execute_update_addresses_taken (void)
 		if (gimple_assign_lhs (stmt) != lhs)
 		  gimple_assign_set_lhs (stmt, lhs);
 
+		/* For var ={v} {CLOBBER}; where var lost
+		   TREE_ADDRESSABLE just remove the stmt.  */
+		if (DECL_P (lhs)
+		    && TREE_CLOBBER_P (rhs)
+		    && symbol_marked_for_renaming (lhs))
+		  {
+		    unlink_stmt_vdef (stmt);
+      		    gsi_remove (&gsi, true);
+		    release_defs (stmt);
+		    continue;
+		  }
+
 		if (gimple_assign_rhs1 (stmt) != rhs)
 		  {
 		    gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
@@ -2205,6 +2219,8 @@  execute_update_addresses_taken (void)
 	    if (gimple_references_memory_p (stmt)
 		|| is_gimple_debug (stmt))
 	      update_stmt (stmt);
+
+	    gsi_next (&gsi);
 	  }
 
       /* Update SSA form here, we are called as non-pass as well.  */