summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-21 12:37:33 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-21 12:37:33 +0000
commit6b55f6d9ed04b1c4b6a47ad84929ccd2a4b0f2fa (patch)
treea608d53ad0ae105cb54069a711fc6c63a367c516 /gcc/gimplify.c
parentb2a9fb6b9758bc2feae44dca7e3fd3153bc2f628 (diff)
downloadgcc-6b55f6d9ed04b1c4b6a47ad84929ccd2a4b0f2fa.tar.gz
2012-02-21 Richard Guenther <rguenther@suse.de>
PR tree-optimization/52324 * gimplify.c (gimplify_expr): When re-gimplifying expressions do not gimplify a MEM_REF address operand if it is already in suitable form. * gcc.dg/tree-ssa/ssa-lim-10.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184435 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 782adc34caf..a214134c554 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7061,15 +7061,23 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
ret = GS_OK;
break;
}
- ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
- is_gimple_mem_ref_addr, fb_rvalue);
- if (ret == GS_ERROR)
- break;
+ /* Avoid re-gimplifying the address operand if it is already
+ in suitable form. Re-gimplifying would mark the address
+ operand addressable. Always gimplify when not in SSA form
+ as we still may have to gimplify decls with value-exprs. */
+ if (!gimplify_ctxp || !gimplify_ctxp->into_ssa
+ || !is_gimple_mem_ref_addr (TREE_OPERAND (*expr_p, 0)))
+ {
+ ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+ is_gimple_mem_ref_addr, fb_rvalue);
+ if (ret == GS_ERROR)
+ break;
+ }
recalculate_side_effects (*expr_p);
ret = GS_ALL_DONE;
break;
- /* Constants need not be gimplified. */
+ /* Constants need not be gimplified. */
case INTEGER_CST:
case REAL_CST:
case FIXED_CST: