summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-30 13:46:30 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-30 13:46:30 +0000
commit8061ea3e384be224f019d4e9f86ac138de972c0d (patch)
tree4075aa6a3ca867fcf1bacbb54f9f28ccc7e2699c /gcc/gimplify.c
parentac16bf39bd5ef7e5f87149a4ab713ef65377c80f (diff)
downloadgcc-8061ea3e384be224f019d4e9f86ac138de972c0d.tar.gz
2006-01-30 Richard Guenther <rguenther@suse.de>
PR c++/23372 * gimplify.c (gimplify_target_expr): Handle easy cases without creating a temporary. * gcc.dg/pr23372-1.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110396 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index cb1b95eebaa..876160955f5 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4053,6 +4053,15 @@ gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p)
if (init)
{
+ /* Try to avoid the temporary if possible. */
+ if (TREE_CODE (init) == INDIRECT_REF
+ && !TREE_SIDE_EFFECTS (init)
+ && !TARGET_EXPR_CLEANUP (targ))
+ {
+ *expr_p = init;
+ return GS_OK;
+ }
+
/* TARGET_EXPR temps aren't part of the enclosing block, so add it
to the temps list. */
gimple_add_tmp_var (temp);