aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2012-12-19 13:53:18 +0000
committerRichard Biener <rguenther@suse.de>2012-12-19 13:53:18 +0000
commit91d6878d741f21062459db510f66f90af3cd37ed (patch)
tree16f545224cd8116189b4ccd1992329c439c78de9 /gcc/gimplify.c
parent9f908599994545594eebd418d90e2636ac0b7ca9 (diff)
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: https://gcc.gnu.org/svn/gcc/trunk@194609 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c24
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