diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-22 13:19:06 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-22 13:19:06 +0000 |
commit | aee081df0f4394566a5d68879502634d6900e311 (patch) | |
tree | 1edd1d72e20a2228a6757315146395eae0926b90 /gcc/tree-ssa-ter.c | |
parent | 5f468e52abd922b178b97070738ae8e9185bd3d9 (diff) | |
download | gcc-aee081df0f4394566a5d68879502634d6900e311.tar.gz |
2008-07-22 Basile Starynkevitch <basile@starynkevitch.net>
MERGED WITH TRUNK rev138050
* gcc/compiler-probe.c: more C++ friendly.
* gcc/passes.c: merged with trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@138056 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; } |