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] Fix odd lack of CCP in forwprop


This fixes, compared to CCP, some missed CCP in forwprop.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2010-04-07  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-forwprop.c (forward_propagate_addr_expr):
	Propagate constants everywhere.

Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c	(revision 158059)
+++ gcc/tree-ssa-forwprop.c	(working copy)
@@ -955,9 +955,10 @@ forward_propagate_addr_expr (tree name,
 	}
 
       /* If the use is in a deeper loop nest, then we do not want
-	 to propagate the ADDR_EXPR into the loop as that is likely
-	 adding expression evaluations into the loop.  */
-      if (gimple_bb (use_stmt)->loop_depth > stmt_loop_depth)
+	 to propagate non-invariant ADDR_EXPRs into the loop as that
+	 is likely adding expression evaluations into the loop.  */
+      if (gimple_bb (use_stmt)->loop_depth > stmt_loop_depth
+	  && !is_gimple_min_invariant (rhs))
 	{
 	  all = false;
 	  continue;


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