Commit 7a667e64 by Richard Sandiford Committed by Richard Sandiford

Minor vn_reference_lookup_3 tweak

The repeated checks for MEM_REF made this code hard to convert to
poly_ints as-is.  Hopefully the new structure also makes it clearer
at a glance what the two cases are.

2017-12-16  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Avoid repeated
	checks for MEM_REF.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r255742
parent 9adab579
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
* tree-ssa-sccvn.c (vn_reference_lookup_3): Avoid repeated
checks for MEM_REF.
2017-12-16 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* doc/generic.texi (VEC_SERIES_EXPR): Document. * doc/generic.texi (VEC_SERIES_EXPR): Document.
* doc/md.texi (vec_series@var{m}): Document. * doc/md.texi (vec_series@var{m}): Document.
* tree.def (VEC_SERIES_EXPR): New tree code. * tree.def (VEC_SERIES_EXPR): New tree code.
...@@ -2348,19 +2348,19 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, ...@@ -2348,19 +2348,19 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
copy_size = tree_to_uhwi (gimple_call_arg (def_stmt, 2)); copy_size = tree_to_uhwi (gimple_call_arg (def_stmt, 2));
/* The bases of the destination and the references have to agree. */ /* The bases of the destination and the references have to agree. */
if ((TREE_CODE (base) != MEM_REF
&& !DECL_P (base))
|| (TREE_CODE (base) == MEM_REF
&& (TREE_OPERAND (base, 0) != lhs
|| !tree_fits_uhwi_p (TREE_OPERAND (base, 1))))
|| (DECL_P (base)
&& (TREE_CODE (lhs) != ADDR_EXPR
|| TREE_OPERAND (lhs, 0) != base)))
return (void *)-1;
at = offset / BITS_PER_UNIT; at = offset / BITS_PER_UNIT;
if (TREE_CODE (base) == MEM_REF) if (TREE_CODE (base) == MEM_REF)
at += tree_to_uhwi (TREE_OPERAND (base, 1)); {
if (TREE_OPERAND (base, 0) != lhs
|| !tree_fits_uhwi_p (TREE_OPERAND (base, 1)))
return (void *) -1;
at += tree_to_uhwi (TREE_OPERAND (base, 1));
}
else if (!DECL_P (base)
|| TREE_CODE (lhs) != ADDR_EXPR
|| TREE_OPERAND (lhs, 0) != base)
return (void *)-1;
/* If the access is completely outside of the memcpy destination /* If the access is completely outside of the memcpy destination
area there is no aliasing. */ area there is no aliasing. */
if (lhs_offset >= at + maxsize / BITS_PER_UNIT if (lhs_offset >= at + maxsize / BITS_PER_UNIT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment