aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-05-22 11:25:14 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-05-22 11:25:14 +0000
commit81d5198d0093ab144c8a13b85c56ef496192f930 (patch)
treeb60673aa2d1387e9620b928566b7877a2b576894 /gcc/tree-ssa-sccvn.c
parenta6df9d9044965e3a265ead57bc516a450ad87bf6 (diff)
downloadgcc-81d5198d0093ab144c8a13b85c56ef496192f930.zip
gcc-81d5198d0093ab144c8a13b85c56ef496192f930.tar.gz
gcc-81d5198d0093ab144c8a13b85c56ef496192f930.tar.bz2
re PR tree-optimization/85834 (ice in set_ssa_val_to, at tree-ssa-sccvn.c:3396)
2018-05-22 Richard Biener <rguenther@suse.de> PR tree-optimization/85834 * tree-ssa-sccvn.c (vn_reference_lookup_3): Properly handle non-constant and non-zero memset arguments. * g++.dg/torture/pr85834.C: New testcase. * gcc.dg/tree-ssa/ssa-fre-64.c: Likewise. From-SVN: r260503
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 39de866..884cce1 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1959,7 +1959,12 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
if (is_gimple_reg_type (vr->type)
&& gimple_call_builtin_p (def_stmt, BUILT_IN_MEMSET)
&& (integer_zerop (gimple_call_arg (def_stmt, 1))
- || (INTEGRAL_TYPE_P (vr->type) && known_eq (ref->size, 8)))
+ || (INTEGRAL_TYPE_P (vr->type)
+ && CHAR_BIT == 8 && BITS_PER_UNIT == 8
+ && known_eq (ref->size, 8)
+ && known_eq (ref->size, maxsize)
+ && offset.is_constant (&offseti)
+ && offseti % BITS_PER_UNIT == 0))
&& poly_int_tree_p (gimple_call_arg (def_stmt, 2))
&& (TREE_CODE (gimple_call_arg (def_stmt, 0)) == ADDR_EXPR
|| TREE_CODE (gimple_call_arg (def_stmt, 0)) == SSA_NAME))
@@ -2026,7 +2031,16 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
if (integer_zerop (gimple_call_arg (def_stmt, 1)))
val = build_zero_cst (vr->type);
else
- val = fold_convert (vr->type, gimple_call_arg (def_stmt, 1));
+ {
+ code_helper rcode = NOP_EXPR;
+ tree ops[3] = {};
+ ops[0] = gimple_call_arg (def_stmt, 1);
+ val = vn_nary_build_or_lookup (rcode, vr->type, ops);
+ if (!val
+ || (TREE_CODE (val) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val)))
+ return (void *)-1;
+ }
return vn_reference_lookup_or_insert_for_pieces
(vuse, vr->set, vr->type, vr->operands, val);
}