summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
diff options
context:
space:
mode:
authordberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-15 15:39:19 +0000
committerdberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-15 15:39:19 +0000
commit455615ca2d1277a18ddada0d090d19f5ab829479 (patch)
treed67cc52bad68a52d9ce044943f919a395ac5d675 /gcc/tree-ssa-pre.c
parentc6c60ec6d6267ac80ddc1cbbc6da30b8074f9edf (diff)
downloadgcc-455615ca2d1277a18ddada0d090d19f5ab829479.tar.gz
2005-04-14 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa-pre.c (compute_avail): It's okay to have TREE_INVARIANT's here, and value number the resulting expressions. (create_expression_by_pieces): Make sure operands that were min_invariant when we started, stay that way. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98187 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r--gcc/tree-ssa-pre.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index cecc97ecb63..2e2788eea16 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -950,6 +950,10 @@ phi_translate (tree expr, value_set_t set, basic_block pred,
}
}
+/* For each expression in SET, translate the value handles through phi nodes
+ in PHIBLOCK using edge PHIBLOCK->PRED, and store the resulting
+ expressions in DEST. */
+
static void
phi_translate_set (value_set_t dest, value_set_t set, basic_block pred,
basic_block phiblock)
@@ -1370,7 +1374,7 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
case tcc_unary:
{
tree_stmt_iterator tsi;
- tree forced_stmts;
+ tree forced_stmts = NULL;
tree genop1;
tree temp;
tree folded;
@@ -1380,7 +1384,14 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
add_referenced_tmp_var (temp);
folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr),
genop1));
- newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL);
+ /* If the generated operand is already GIMPLE min_invariant
+ just use it instead of calling force_gimple_operand on it,
+ since that may make it not invariant by copying it into an
+ assignment. */
+ if (!is_gimple_min_invariant (genop1))
+ newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL);
+ else
+ newexpr = genop1;
if (forced_stmts)
{
tsi = tsi_start (forced_stmts);
@@ -1963,11 +1974,10 @@ compute_avail (void)
vuse_optype vuses = STMT_VUSE_OPS (stmt);
STRIP_USELESS_TYPE_CONVERSION (rhs);
- if ((UNARY_CLASS_P (rhs)
+ if (UNARY_CLASS_P (rhs)
|| BINARY_CLASS_P (rhs)
|| COMPARISON_CLASS_P (rhs)
|| REFERENCE_CLASS_P (rhs))
- && !TREE_INVARIANT (rhs))
{
/* For binary, unary, and reference expressions,
create a duplicate expression with the operands
@@ -1985,6 +1995,7 @@ compute_avail (void)
else if (TREE_CODE (rhs) == SSA_NAME
|| is_gimple_min_invariant (rhs)
|| TREE_CODE (rhs) == ADDR_EXPR
+ || TREE_INVARIANT (rhs)
|| DECL_P (rhs))
{
/* Compute a value number for the RHS of the statement