+2008-02-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR middle-end/35136
+ * gimplify.c (force_gimple_operand_bsi): Revert 2008-02-12 change.
+ (force_gimple_operand): Likewise.
+ * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Add new cases
+ for TARGET_MEM_REF and CONVERT_EXPR/NON_LVALUE_EXPR/NOP_EXPR.
+ Also recurse on the operand for regular VIEW_CONVERT_EXPRs.
+ (find_interesting_uses_address): Check addressability and alignment
+ of the base expression only after substituting bases of IVs into it.
+
2008-02-14 Michael Matz <matz@suse.de>
PR target/34930
pop_gimplify_context (NULL);
- if (*stmts && gimple_in_ssa_p (cfun))
- {
- tree_stmt_iterator tsi;
-
- for (tsi = tsi_start (*stmts); !tsi_end_p (tsi); tsi_next (&tsi))
- mark_symbols_for_renaming (tsi_stmt (tsi));
- }
-
return expr;
}
expr = force_gimple_operand (expr, &stmts, simple_p, var);
if (stmts)
{
+ if (gimple_in_ssa_p (cfun))
+ {
+ tree_stmt_iterator tsi;
+
+ for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
+ mark_symbols_for_renaming (tsi_stmt (tsi));
+ }
+
if (before)
bsi_insert_before (bsi, stmts, m);
else
{
switch (TREE_CODE (expr))
{
+ case TARGET_MEM_REF:
+ /* TARGET_MEM_REFs are translated directly to valid MEMs on the
+ target, thus they are always addressable. */
+ return false;
+
case COMPONENT_REF:
return DECL_NONADDRESSABLE_P (TREE_OPERAND (expr, 1))
|| may_be_nonaddressable_p (TREE_OPERAND (expr, 0));
- case ARRAY_REF:
- case ARRAY_RANGE_REF:
- return may_be_nonaddressable_p (TREE_OPERAND (expr, 0));
-
case VIEW_CONVERT_EXPR:
/* This kind of view-conversions may wrap non-addressable objects
and make them look addressable. After some processing the
non-addressability may be uncovered again, causing ADDR_EXPRs
of inappropriate objects to be built. */
- return AGGREGATE_TYPE_P (TREE_TYPE (expr))
- && !AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0)));
+ if (AGGREGATE_TYPE_P (TREE_TYPE (expr))
+ && !AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0))))
+ return true;
+
+ /* ... fall through ... */
+
+ case ARRAY_REF:
+ case ARRAY_RANGE_REF:
+ return may_be_nonaddressable_p (TREE_OPERAND (expr, 0));
+
+ case CONVERT_EXPR:
+ case NON_LVALUE_EXPR:
+ case NOP_EXPR:
+ return true;
default:
break;
if (TREE_CODE (base) == BIT_FIELD_REF)
goto fail;
- if (may_be_nonaddressable_p (base))
- goto fail;
-
- if (STRICT_ALIGNMENT
- && may_be_unaligned_p (base))
- goto fail;
-
base = unshare_expr (base);
if (TREE_CODE (base) == TARGET_MEM_REF)
gcc_assert (TREE_CODE (base) != ALIGN_INDIRECT_REF);
gcc_assert (TREE_CODE (base) != MISALIGNED_INDIRECT_REF);
+ /* Check that the base expression is addressable. This needs
+ to be done after substituting bases of IVs into it. */
+ if (may_be_nonaddressable_p (base))
+ goto fail;
+
+ /* Moreover, on strict alignment platforms, check that it is
+ sufficiently aligned. */
+ if (STRICT_ALIGNMENT && may_be_unaligned_p (base))
+ goto fail;
+
base = build_fold_addr_expr (base);
/* Substituting bases of IVs into the base expression might