This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix odd lack of CCP in forwprop
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 7 Apr 2010 16:33:31 +0200 (CEST)
- Subject: [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;