summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-14 16:07:16 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-14 16:07:16 +0000
commit1928904fc905dda7a5a503647034e602178f5fca (patch)
tree0cb67f26899659bf3d6034329e825c218036d372 /gcc/gimplify.c
parent4840d588a4af40ca7b957c17a4ac58671653f6d9 (diff)
downloadgcc-1928904fc905dda7a5a503647034e602178f5fca.tar.gz
re-apply fold_indirect_ref patch
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95024 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 0fd39436325..d461d776ee8 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1433,8 +1433,15 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
VARRAY_GENERIC_PTR_NOGC_INIT (stack, 10, "stack");
/* We can handle anything that get_inner_reference can deal with. */
- for (p = expr_p; handled_component_p (*p); p = &TREE_OPERAND (*p, 0))
- VARRAY_PUSH_GENERIC_PTR_NOGC (stack, *p);
+ for (p = expr_p; ; p = &TREE_OPERAND (*p, 0))
+ {
+ /* Fold INDIRECT_REFs now to turn them into ARRAY_REFs. */
+ if (TREE_CODE (*p) == INDIRECT_REF)
+ *p = fold_indirect_ref (*p);
+ if (!handled_component_p (*p))
+ break;
+ VARRAY_PUSH_GENERIC_PTR_NOGC (stack, *p);
+ }
gcc_assert (VARRAY_ACTIVE_SIZE (stack));
@@ -2845,16 +2852,10 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
This kind of code arises in C++ when an object is bound
to a const reference, and if "x" is a TARGET_EXPR we want
to take advantage of the optimization below. */
- tree pointer;
-
- pointer = TREE_OPERAND (*from_p, 0);
- STRIP_NOPS (pointer);
- if (TREE_CODE (pointer) == ADDR_EXPR
- && (lang_hooks.types_compatible_p
- (TREE_TYPE (TREE_OPERAND (pointer, 0)),
- TREE_TYPE (*from_p))))
+ tree t = fold_indirect_ref (*from_p);
+ if (t != *from_p)
{
- *from_p = TREE_OPERAND (pointer, 0);
+ *from_p = t;
ret = GS_OK;
}
else
@@ -3544,7 +3545,7 @@ gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p)
ret = GS_OK;
if (TREE_CODE (init) == BIND_EXPR)
gimplify_bind_expr (&init, temp, pre_p);
- if (init != temp)
+ if (init != temp)
{
init = build (MODIFY_EXPR, void_type_node, temp, init);
ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt,
@@ -3795,9 +3796,13 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
recalculate_side_effects (*expr_p);
break;
+ case INDIRECT_REF:
+ *expr_p = fold_indirect_ref (*expr_p);
+ if (*expr_p != save_expr)
+ break;
+ /* else fall through. */
case ALIGN_INDIRECT_REF:
case MISALIGNED_INDIRECT_REF:
- case INDIRECT_REF:
ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
is_gimple_reg, fb_rvalue);
recalculate_side_effects (*expr_p);