+2014-05-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2013-05-27 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/57417
+ * tree-ssa-sccvn.c (set_ssa_val_to): Compare addresses using
+ get_addr_base_and_unit_offset.
+
2014-04-25 Eric Botcazou <ebotcazou@adacore.com>
PR target/60941
+2014-05-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2013-05-27 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/57417
+ * gcc.dg/torture/pr57417.c: New testcase.
+
2014-04-25 Eric Botcazou <ebotcazou@adacore.com>
* gcc.c-torture/execute/20140425-1.c: New test.
set_ssa_val_to (tree from, tree to)
{
tree currval = SSA_VAL (from);
+ HOST_WIDE_INT toff, coff;
if (from != to)
{
print_generic_expr (dump_file, to, 0);
}
- if (currval != to && !operand_equal_p (currval, to, OEP_PURE_SAME))
+ if (currval != to
+ && !operand_equal_p (currval, to, OEP_PURE_SAME)
+ /* ??? For addresses involving volatile objects or types operand_equal_p
+ does not reliably detect ADDR_EXPRs as equal. We know we are only
+ getting invariant gimple addresses here, so can use
+ get_addr_base_and_unit_offset to do this comparison. */
+ && !(TREE_CODE (currval) == ADDR_EXPR
+ && TREE_CODE (to) == ADDR_EXPR
+ && (get_addr_base_and_unit_offset (TREE_OPERAND (currval, 0), &coff)
+ == get_addr_base_and_unit_offset (TREE_OPERAND (to, 0), &toff))
+ && coff == toff))
{
VN_INFO (from)->valnum = to;
if (dump_file && (dump_flags & TDF_DETAILS))