public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Remove unused arguments of bulitin_unreachable
@ 2014-12-11 17:07 Jan Hubicka
  2014-12-11 17:13 ` Jakub Jelinek
  2014-12-22 18:14 ` Jeff Law
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Hubicka @ 2014-12-11 17:07 UTC (permalink / raw)
  To: gcc-patches, rguenther

Hi,
in firefox .optimized dumps one can see few places where __builtin_unreachable
is called (as a result of devirtualization code proving the code path to be
undefined).  There is usually some argument setup for the parameters of
__builtin_unreachable that are dead.  This patch makes it somewhat better 
so now we get:
  <bb 30>:                                                                      
  # prephitmp_222 = PHI <_52(27), pretmp_245(29)>                               
  _57 = prephitmp_222 + 2;                                                      
  pool_40(D)->ptr = _57;                                                        
  __builtin_unreachable ();                                                     

Why DSE does not eliminate the stores prior noreturn const function?

Bootstrapped/regtested x86_64-linux, OK?

Honza
	* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Remove dead parameters
	of BUILT_IN_UNREACHABLE

Index: tree-ssa-dce.c
===================================================================
--- tree-ssa-dce.c	(revision 218610)
+++ tree-ssa-dce.c	(working copy)
@@ -250,6 +250,15 @@ mark_stmt_if_obviously_necessary (gimple
 	    case BUILT_IN_ALLOCA:
 	    case BUILT_IN_ALLOCA_WITH_ALIGN:
 	      return;
+	    case BUILT_IN_UNREACHABLE:
+	      /* All parameters of BUILT_IN_UNREACHABLE are dead.  Remove them
+		 from the stmt, so we can remove their definitions.  */
+	      if (gimple_call_num_args (stmt))
+		{
+		  gimple_set_num_ops (stmt, 3);
+		  update_stmt (stmt);
+		}
+	      break;
 
 	    default:;
 	    }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-22 18:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-11 17:07 Remove unused arguments of bulitin_unreachable Jan Hubicka
2014-12-11 17:13 ` Jakub Jelinek
2014-12-11 18:16   ` Jan Hubicka
2014-12-11 21:05     ` Martin Jambor
2014-12-12  9:19     ` Richard Biener
2014-12-22 18:14 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).