aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2005-08-01 08:58:25 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2005-08-01 08:58:25 +0000
commita8f82ec4377e4a314ec3d602f8f1f603bd76b749 (patch)
tree0ac2d5dd61af001d5b05d83f9c8b9c54f5ce7b48
parentac264fef2367c4773f4ed4868bdaa13c39b1ab44 (diff)
downloadgcc-a8f82ec4377e4a314ec3d602f8f1f603bd76b749.zip
gcc-a8f82ec4377e4a314ec3d602f8f1f603bd76b749.tar.gz
gcc-a8f82ec4377e4a314ec3d602f8f1f603bd76b749.tar.bz2
re PR tree-optimization/23133 (recip does not factor division by function parameter)
2005-08-01 Richard Guenther <rguenther@suse.de> PR tree-optimization/23133 * tree-ssa-math-opts.c (execute_cse_reciprocals): Walk current functions parameter decls to find defs to cse reciprocals of. From-SVN: r102628
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/tree-ssa-math-opts.c12
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 07b3141..a4818a4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2005-08-01 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/23133
+ * tree-ssa-math-opts.c (execute_cse_reciprocals): Walk
+ current functions parameter decls to find defs to cse
+ reciprocals of.
+
+2005-08-01 Richard Guenther <rguenther@suse.de>
+
PR tree-optimization/23109
* tree-ssa-math-opts.c (execute_cse_reciprocals_1):
If trapping math is in effect, use post-dominator information
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index bff3c1d..be2d758 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -122,10 +122,20 @@ static void
execute_cse_reciprocals (void)
{
basic_block bb;
+ tree arg;
if (flag_trapping_math)
calculate_dominance_info (CDI_POST_DOMINATORS);
+ if (single_succ_p (ENTRY_BLOCK_PTR))
+ for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = TREE_CHAIN (arg))
+ if (default_def (arg))
+ {
+ block_stmt_iterator bsi;
+ bsi = bsi_start (single_succ (ENTRY_BLOCK_PTR));
+ execute_cse_reciprocals_1 (&bsi, default_def (arg), false);
+ }
+
FOR_EACH_BB (bb)
{
block_stmt_iterator bsi;
@@ -149,7 +159,7 @@ execute_cse_reciprocals (void)
if (TREE_CODE (stmt) == MODIFY_EXPR
&& (def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF)) != NULL
&& FLOAT_TYPE_P (TREE_TYPE (def))
- && is_gimple_reg (def))
+ && TREE_CODE (def) == SSA_NAME)
execute_cse_reciprocals_1 (&bsi, def, false);
}
}