+2010-09-04 Richard Guenther <rguenther@suse.de>
+
+ PR bootstrap/45519
+ * tree-flow.h (force_gimple_operand_1): Declare.
+ (force_gimple_operand_gsi_1): Likewise.
+ * gimplify.c (force_gimple_operand_1): New worker taking a
+ gimple predicate for ...
+ (force_gimple_operand): ... which now wraps it.
+ (force_gimple_operand_gsi_1, force_gimple_operand_gsi): Likewise.
+ * tree-ssa-loop-ivopts.c (find_interesting_uses_address): Revert
+ last change.
+ * tree-ssa-address.c (gimplify_mem_ref_parts): Use
+ force_gimple_operand_gsi_1 with is_gimple_mem_ref_addr.
+ (create_mem_ref): Likewise.
+
2010-09-04 Uros Bizjak <ubizjak@gmail.com>
* config/i386/predicates.md (sse_reg_operand): New predicate.
}
-/* Expands EXPR to list of gimple statements STMTS. If SIMPLE is true,
- force the result to be either ssa_name or an invariant, otherwise
- just force it to be a rhs expression. If VAR is not NULL, make the
+/* Expands EXPR to list of gimple statements STMTS. GIMPLE_TEST_F specifies
+ the predicate that will hold for the result. If VAR is not NULL, make the
base variable of the final destination be VAR if suitable. */
tree
-force_gimple_operand (tree expr, gimple_seq *stmts, bool simple, tree var)
+force_gimple_operand_1 (tree expr, gimple_seq *stmts,
+ gimple_predicate gimple_test_f, tree var)
{
tree t;
enum gimplify_status ret;
- gimple_predicate gimple_test_f;
struct gimplify_ctx gctx;
*stmts = NULL;
if (is_gimple_val (expr))
return expr;
- gimple_test_f = simple ? is_gimple_val : is_gimple_reg_rhs;
-
push_gimplify_context (&gctx);
gimplify_ctxp->into_ssa = gimple_in_ssa_p (cfun);
gimplify_ctxp->allow_rhs_cond_expr = true;
return expr;
}
-/* Invokes force_gimple_operand for EXPR with parameters SIMPLE_P and VAR. If
- some statements are produced, emits them at GSI. If BEFORE is true.
- the statements are appended before GSI, otherwise they are appended after
- it. M specifies the way GSI moves after insertion (GSI_SAME_STMT or
- GSI_CONTINUE_LINKING are the usual values). */
+/* Expands EXPR to list of gimple statements STMTS. If SIMPLE is true,
+ force the result to be either ssa_name or an invariant, otherwise
+ just force it to be a rhs expression. If VAR is not NULL, make the
+ base variable of the final destination be VAR if suitable. */
tree
-force_gimple_operand_gsi (gimple_stmt_iterator *gsi, tree expr,
- bool simple_p, tree var, bool before,
- enum gsi_iterator_update m)
+force_gimple_operand (tree expr, gimple_seq *stmts, bool simple, tree var)
+{
+ return force_gimple_operand_1 (expr, stmts,
+ simple ? is_gimple_val : is_gimple_reg_rhs,
+ var);
+}
+
+/* Invokes force_gimple_operand_1 for EXPR with parameters GIMPLE_TEST_F
+ and VAR. If some statements are produced, emits them at GSI.
+ If BEFORE is true. the statements are appended before GSI, otherwise
+ they are appended after it. M specifies the way GSI moves after
+ insertion (GSI_SAME_STMT or GSI_CONTINUE_LINKING are the usual values). */
+
+tree
+force_gimple_operand_gsi_1 (gimple_stmt_iterator *gsi, tree expr,
+ gimple_predicate gimple_test_f,
+ tree var, bool before,
+ enum gsi_iterator_update m)
{
gimple_seq stmts;
- expr = force_gimple_operand (expr, &stmts, simple_p, var);
+ expr = force_gimple_operand_1 (expr, &stmts, gimple_test_f, var);
if (!gimple_seq_empty_p (stmts))
{
return expr;
}
+/* Invokes force_gimple_operand_1 for EXPR with parameter VAR.
+ If SIMPLE is true, force the result to be either ssa_name or an invariant,
+ otherwise just force it to be a rhs expression. If some statements are
+ produced, emits them at GSI. If BEFORE is true, the statements are
+ appended before GSI, otherwise they are appended after it. M specifies
+ the way GSI moves after insertion (GSI_SAME_STMT or GSI_CONTINUE_LINKING
+ are the usual values). */
+
+tree
+force_gimple_operand_gsi (gimple_stmt_iterator *gsi, tree expr,
+ bool simple_p, tree var, bool before,
+ enum gsi_iterator_update m)
+{
+ return force_gimple_operand_gsi_1 (gsi, expr,
+ simple_p
+ ? is_gimple_val : is_gimple_reg_rhs,
+ var, before, m);
+}
+
+
#include "gt-gimplify.h"
extern void register_jump_thread (edge, edge);
/* In gimplify.c */
+tree force_gimple_operand_1 (tree, gimple_seq *, gimple_predicate, tree);
tree force_gimple_operand (tree, gimple_seq *, bool, tree);
+tree force_gimple_operand_gsi_1 (gimple_stmt_iterator *, tree,
+ gimple_predicate, tree,
+ bool, enum gsi_iterator_update);
tree force_gimple_operand_gsi (gimple_stmt_iterator *, tree, bool, tree,
bool, enum gsi_iterator_update);
tree gimple_fold_indirect_ref (tree);
gimplify_mem_ref_parts (gimple_stmt_iterator *gsi, struct mem_address *parts)
{
if (parts->base)
- parts->base = force_gimple_operand_gsi (gsi, parts->base,
- true, NULL_TREE,
+ parts->base = force_gimple_operand_gsi_1 (gsi, parts->base,
+ is_gimple_mem_ref_addr, NULL_TREE,
true, GSI_SAME_STMT);
if (parts->index)
parts->index = force_gimple_operand_gsi (gsi, parts->index,
if (parts.index)
{
atype = TREE_TYPE (tmp);
- parts.base = force_gimple_operand_gsi (gsi,
+ parts.base = force_gimple_operand_gsi_1 (gsi,
fold_build2 (POINTER_PLUS_EXPR, atype,
tmp,
fold_convert (sizetype, parts.base)),
- true, NULL_TREE, true, GSI_SAME_STMT);
+ is_gimple_mem_ref_addr, NULL_TREE, true, GSI_SAME_STMT);
}
else
{
if (parts.base)
{
atype = TREE_TYPE (parts.base);
- parts.base = force_gimple_operand_gsi (gsi,
+ parts.base = force_gimple_operand_gsi_1 (gsi,
fold_build2 (POINTER_PLUS_EXPR, atype,
parts.base,
parts.index),
- true, NULL_TREE, true, GSI_SAME_STMT);
+ is_gimple_mem_ref_addr, NULL_TREE, true, GSI_SAME_STMT);
}
else
parts.base = parts.index;
if (parts.base)
{
atype = TREE_TYPE (parts.base);
- parts.base = force_gimple_operand_gsi (gsi,
+ parts.base = force_gimple_operand_gsi_1 (gsi,
fold_build2 (POINTER_PLUS_EXPR, atype,
parts.base,
fold_convert (sizetype, parts.offset)),
- true, NULL_TREE, true, GSI_SAME_STMT);
+ is_gimple_mem_ref_addr, NULL_TREE, true, GSI_SAME_STMT);
}
else
parts.base = parts.offset;
ref = &TREE_OPERAND (*ref, 0);
if (TREE_CODE (*ref) == MEM_REF)
{
- tree tem = TREE_OPERAND (*ref, 0);
- STRIP_NOPS (tem);
- if (tem != TREE_OPERAND (*ref, 0))
- tem = fold_build2 (MEM_REF, TREE_TYPE (*ref),
- tem, TREE_OPERAND (*ref, 1));
- else
- tem = fold_binary (MEM_REF, TREE_TYPE (*ref),
- tem, TREE_OPERAND (*ref, 1));
+ tree tem = fold_binary (MEM_REF, TREE_TYPE (*ref),
+ TREE_OPERAND (*ref, 0),
+ TREE_OPERAND (*ref, 1));
if (tem)
*ref = tem;
}