diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-20 16:06:51 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-20 16:06:51 +0000 |
commit | bff4202c718b3d92e33079c77431e536e30d1ffe (patch) | |
tree | b70810f9d05350b4f20a9fb3104039f83b6b3bb3 /gcc/tree-ssa-ter.c | |
parent | 8188ae06de203ace69d3dafa612b7712a8dd1c94 (diff) | |
download | gcc-bff4202c718b3d92e33079c77431e536e30d1ffe.tar.gz |
* cgraph.c (cgraph_add_new_function): Do early local passes.
* tree-nrv.c (gate_pass_return_slot): New gate.
(pass_nrv): Add the gate.
* tree-ssa-coalese.c (hash_ssa_name_by_var, eq_ssa_name_by_var): New
functions.
(coalesce_ssa_name): Coalesce SSA names.
* tree-ssa-live.c (remove_unused_locals): Be more conservative when
not optimizing so unused user vars remains visible.
* common.opt (flag_tree_ter): Always enable by default.
* tree-ssa-ter.c: Include flags.h
(is_replaceable_p): Check that locations match; when aliasing is missing
be conservative about loads.
* tree-optimize.c (gate_init_datastructures): Remove.
(pass_init_datastructures): New.
* passes.c: Reorder passes so we always go into SSA.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138010 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-ter.c')
-rw-r--r-- | gcc/tree-ssa-ter.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c index a93001a985b..e02867520c8 100644 --- a/gcc/tree-ssa-ter.c +++ b/gcc/tree-ssa-ter.c @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-flow.h" #include "tree-dump.h" #include "tree-ssa-live.h" +#include "flags.h" /* Temporary Expression Replacement (TER) @@ -364,6 +365,8 @@ is_replaceable_p (tree stmt) tree call_expr; use_operand_p use_p; tree def, use_stmt; + location_t locus1, locus2; + tree block1, block2; /* Only consider modify stmts. */ if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) @@ -386,6 +389,36 @@ is_replaceable_p (tree stmt) if (bb_for_stmt (use_stmt) != bb_for_stmt (stmt)) return false; + if (GIMPLE_STMT_P (stmt)) + { + locus1 = GIMPLE_STMT_LOCUS (stmt); + block1 = GIMPLE_STMT_BLOCK (stmt); + } + else + { + locus1 = *EXPR_LOCUS (stmt); + block1 = TREE_BLOCK (stmt); + } + if (GIMPLE_STMT_P (use_stmt)) + { + locus2 = GIMPLE_STMT_LOCUS (use_stmt); + block2 = GIMPLE_STMT_BLOCK (use_stmt); + } + if (TREE_CODE (use_stmt) == PHI_NODE) + { + locus2 = 0; + block2 = NULL_TREE; + } + else + { + locus2 = *EXPR_LOCUS (use_stmt); + block2 = TREE_BLOCK (use_stmt); + } + + if (!optimize + && ((locus1 && locus1 != locus2) || (block1 && block1 != block2))) + return false; + /* Used in this block, but at the TOP of the block, not the end. */ if (TREE_CODE (use_stmt) == PHI_NODE) return false; @@ -394,6 +427,10 @@ is_replaceable_p (tree stmt) if (!(ZERO_SSA_OPERANDS (stmt, SSA_OP_VDEF))) return false; + /* Without alias info we can't move around loads. */ + if (stmt_ann (stmt)->references_memory && !optimize) + return false; + /* Float expressions must go through memory if float-store is on. */ if (flag_float_store && FLOAT_TYPE_P (TREE_TYPE (GENERIC_TREE_OPERAND (stmt, 1)))) @@ -412,7 +449,6 @@ is_replaceable_p (tree stmt) /* Leave any stmt with volatile operands alone as well. */ if (stmt_ann (stmt)->has_volatile_ops) return false; - return true; } |