This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Ignore CLOBBER stmts in ipa-split (PR tree-optimization/52019)


Hi!

IMHO we should treat CLOBBER stmts in various places like debug stmts,
they shouldn't affect the decisions of the optimization phases, but
if the pass does some transformation that somehow invalidates them or
moves them (not in this pass), it needs to be adjusted.  Otherwise we end
up with the CLOBBERs inhibiting optimizations.

This seems to work for ipa-split, the actual transformations DTRT
apparently.  Bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

2012-02-23  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/52019
	* ipa-split.c (find_return_bb, find_retval, visit_bb): Ignore
	CLOBBER stmts.

	* gcc.dg/tree-ssa/ipa-split-6.c: New test.

--- gcc/ipa-split.c.jj	2012-01-23 18:23:55.000000000 +0100
+++ gcc/ipa-split.c	2012-02-23 12:30:21.877609719 +0100
@@ -1,5 +1,5 @@
 /* Function splitting pass
-   Copyright (C) 2010, 2011
+   Copyright (C) 2010, 2011, 2012
    Free Software Foundation, Inc.
    Contributed by Jan Hubicka  <jh@suse.cz>
 
@@ -624,7 +624,9 @@ find_return_bb (void)
   for (bsi = gsi_last_bb (e->src); !gsi_end_p (bsi); gsi_prev (&bsi))
     {
       gimple stmt = gsi_stmt (bsi);
-      if (gimple_code (stmt) == GIMPLE_LABEL || is_gimple_debug (stmt))
+      if (gimple_code (stmt) == GIMPLE_LABEL
+	  || is_gimple_debug (stmt)
+	  || gimple_clobber_p (stmt))
 	;
       else if (gimple_code (stmt) == GIMPLE_ASSIGN
 	       && found_return
@@ -657,7 +659,8 @@ find_retval (basic_block return_bb)
   for (bsi = gsi_start_bb (return_bb); !gsi_end_p (bsi); gsi_next (&bsi))
     if (gimple_code (gsi_stmt (bsi)) == GIMPLE_RETURN)
       return gimple_return_retval (gsi_stmt (bsi));
-    else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN)
+    else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
+	     && !gimple_clobber_p (gsi_stmt (bsi)))
       return gimple_assign_rhs1 (gsi_stmt (bsi));
   return NULL;
 }
@@ -733,6 +736,9 @@ visit_bb (basic_block bb, basic_block re
       if (is_gimple_debug (stmt))
 	continue;
 
+      if (gimple_clobber_p (stmt))
+	continue;
+
       /* FIXME: We can split regions containing EH.  We can not however
 	 split RESX, EH_DISPATCH and EH_POINTER referring to same region
 	 into different partitions.  This would require tracking of
--- gcc/testsuite/gcc.dg/tree-ssa/ipa-split-6.c.jj	2012-02-23 12:33:20.578790182 +0100
+++ gcc/testsuite/gcc.dg/tree-ssa/ipa-split-6.c	2012-02-23 12:34:05.050612776 +0100
@@ -0,0 +1,10 @@
+/* PR tree-optimization/52019 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-tree-sra -fdump-tree-fnsplit -fdump-tree-optimized" } */
+
+#include "ipa-split-5.c"
+
+/* { dg-final { scan-tree-dump-times "Splitting function" 1 "fnsplit"} } */
+/* { dg-final { cleanup-tree-dump "fnsplit" } } */
+/* { dg-final { scan-tree-dump "part" "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]