aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-07-18 07:35:40 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-07-18 07:35:40 +0000
commitf9bfe3f57e74f85d2d548ba470303f1feb97f3bf (patch)
tree9ec1e7a1891bb4a5f04d44bddc9d387b26111adb /gcc/tree-ssa-pre.c
parentd2e78d766294a5e548c2eaf92f07a8f768120e1c (diff)
downloadgcc-f9bfe3f57e74f85d2d548ba470303f1feb97f3bf.zip
gcc-f9bfe3f57e74f85d2d548ba470303f1feb97f3bf.tar.gz
gcc-f9bfe3f57e74f85d2d548ba470303f1feb97f3bf.tar.bz2
re PR tree-optimization/80620 (gcc produces wrong code with -O3)
2017-07-18 Richard Biener <rguenther@suse.de> PR tree-optimization/80620 PR tree-optimization/81403 * tree-ssa-pre.c (phi_translate_1): Clear range and points-to info when re-using a VN table entry. * gcc.dg/torture/pr80620.c: New testcase. * gcc.dg/torture/pr81403.c: Likewise. From-SVN: r250297
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r--gcc/tree-ssa-pre.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 2a431c9..0ec3d3c 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -1489,6 +1489,45 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
PRE_EXPR_NARY (expr) = nary;
new_val_id = nary->value_id;
get_or_alloc_expression_id (expr);
+ /* When we end up re-using a value number make sure that
+ doesn't have unrelated (which we can't check here)
+ range or points-to info on it. */
+ if (result
+ && INTEGRAL_TYPE_P (TREE_TYPE (result))
+ && SSA_NAME_RANGE_INFO (result)
+ && ! SSA_NAME_IS_DEFAULT_DEF (result))
+ {
+ if (! VN_INFO (result)->info.range_info)
+ {
+ VN_INFO (result)->info.range_info
+ = SSA_NAME_RANGE_INFO (result);
+ VN_INFO (result)->range_info_anti_range_p
+ = SSA_NAME_ANTI_RANGE_P (result);
+ }
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "clearing range info of ");
+ print_generic_expr (dump_file, result);
+ fprintf (dump_file, "\n");
+ }
+ SSA_NAME_RANGE_INFO (result) = NULL;
+ }
+ else if (result
+ && POINTER_TYPE_P (TREE_TYPE (result))
+ && SSA_NAME_PTR_INFO (result)
+ && ! SSA_NAME_IS_DEFAULT_DEF (result))
+ {
+ if (! VN_INFO (result)->info.ptr_info)
+ VN_INFO (result)->info.ptr_info
+ = SSA_NAME_PTR_INFO (result);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "clearing points-to info of ");
+ print_generic_expr (dump_file, result);
+ fprintf (dump_file, "\n");
+ }
+ SSA_NAME_PTR_INFO (result) = NULL;
+ }
}
else
{