diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-19 13:53:18 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-19 13:53:18 +0000 |
commit | 827e392be72812c2ace9e54e7e00ed188fc6828d (patch) | |
tree | 16f545224cd8116189b4ccd1992329c439c78de9 /gcc/gimplify.c | |
parent | d5065e6e5546d31ca14bdf7105d94ca845b2a885 (diff) | |
download | gcc-827e392be72812c2ace9e54e7e00ed188fc6828d.tar.gz |
2012-12-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/55736
PR tree-optimization/55703
* gimplify.c (prune_expr_location): New function.
(unshare_expr_without_location): Likewise.
* tree.h (unshare_expr_without_location): Declare.
* ipa-prop.c (prune_expression_for_jf): Remove.
(prune_expression_for_jf_1): Likewise.
(ipa_set_jf_constant): Use unshare_expr_without_location.
(ipa_set_jf_arith_pass_through): Likewise.
(determine_known_aggregate_parts): Likewise.
* tree-switch-conversion.c (build_constructors): Use
unshare_expr_without_location on all constructor elements.
* gcc.dg/lto/pr55703_0.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194609 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 384adb21c35..f628b8ab3c0 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1059,6 +1059,30 @@ unshare_expr (tree expr) walk_tree (&expr, mostly_copy_tree_r, NULL, NULL); return expr; } + +/* Worker for unshare_expr_without_location. */ + +static tree +prune_expr_location (tree *tp, int *walk_subtrees, void *) +{ + if (EXPR_P (*tp)) + SET_EXPR_LOCATION (*tp, UNKNOWN_LOCATION); + else + *walk_subtrees = 0; + return NULL_TREE; +} + +/* Similar to unshare_expr but also prune all expression locations + from EXPR. */ + +tree +unshare_expr_without_location (tree expr) +{ + walk_tree (&expr, mostly_copy_tree_r, NULL, NULL); + if (EXPR_P (expr)) + walk_tree (&expr, prune_expr_location, NULL, NULL); + return expr; +} /* WRAPPER is a code such as BIND_EXPR or CLEANUP_POINT_EXPR which can both contain statements and have a value. Assign its value to a temporary |