diff mbox

DCE dead IFN_GOMP_SIMD_LANE

Message ID 20141114173347.GB5026@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Nov. 14, 2014, 5:33 p.m. UTC
Hi!

When looking at PR59984, I've noticed that in certain cases we leave
around GOMP_SIMD_LANE calls without lhs.
This internal call is intentionally not ECF_CONST, we don't want it moved
before the loop, and the argument is magic.  But, if nothing uses it
anymore, it isn't needed.

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

2014-11-14  Jakub Jelinek  <jakub@redhat.com>

	* tree-ssa.dce.c (eliminate_unnecessary_stmts): Eliminate
	IFN_GOMP_SIMD_LANE without lhs as useless.


	Jakub

Comments

Jeff Law Nov. 14, 2014, 5:43 p.m. UTC | #1
On 11/14/14 10:33, Jakub Jelinek wrote:
> Hi!
>
> When looking at PR59984, I've noticed that in certain cases we leave
> around GOMP_SIMD_LANE calls without lhs.
> This internal call is intentionally not ECF_CONST, we don't want it moved
> before the loop, and the argument is magic.  But, if nothing uses it
> anymore, it isn't needed.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2014-11-14  Jakub Jelinek  <jakub@redhat.com>
>
> 	* tree-ssa.dce.c (eliminate_unnecessary_stmts): Eliminate
> 	IFN_GOMP_SIMD_LANE without lhs as useless.
OK.  I presume we don't have other functions with similar 
characteristics?  If we did, then we might want a more general interface 
or some way to tag them rather than checking for them by name in DCE.

jeff
diff mbox

Patch

--- gcc/tree-ssa-dce.c.jj	2014-11-12 13:28:47.000000000 +0100
+++ gcc/tree-ssa-dce.c	2014-11-14 16:15:10.356124955 +0100
@@ -1402,6 +1402,11 @@  eliminate_unnecessary_stmts (void)
 		  maybe_clean_or_replace_eh_stmt (stmt, stmt);
 		  update_stmt (stmt);
 		  release_ssa_name (name);
+
+		  /* GOMP_SIMD_LANE without lhs is not needed.  */
+		  if (gimple_call_internal_p (stmt)
+		      && gimple_call_internal_fn (stmt) == IFN_GOMP_SIMD_LANE)
+		    remove_dead_stmt (&gsi, bb);
 		}
 	      else if (gimple_call_internal_p (stmt))
 		switch (gimple_call_internal_fn (stmt))