diff options
author | Jeff Law <law@redhat.com> | 2017-01-04 12:22:44 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2017-01-04 12:22:44 -0700 |
commit | 8194635af7f9974ab436603f5c253db110432e8c (patch) | |
tree | c37c49ade4a80b43b518dcb118ddd3258e2f5b90 /gcc/tree-ssa-alias.c | |
parent | baf9ebc8cc9c34becea5be1146c48e2cb99d2ea5 (diff) | |
download | gcc-8194635af7f9974ab436603f5c253db110432e8c.zip gcc-8194635af7f9974ab436603f5c253db110432e8c.tar.gz gcc-8194635af7f9974ab436603f5c253db110432e8c.tar.bz2 |
re PR tree-optimization/67955 (tree-dse does not use pointer info)
PR tree-optimizatin/67955
* tree-ssa-alias.c (same_addr_size_stores_p): Check offsets first.
Allow any SSA_VAR_P as the base objects. Use integer_zerop. Verify
the points-to solution does not include pt_null. Use DECL_PT_UID
unconditionally.
PR tree-optimization/67955
* gcc.dg/tree-ssa/ssa-dse-28.c: New test.
From-SVN: r244067
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 0a9fc74..871fa12 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -2326,9 +2326,13 @@ same_addr_size_stores_p (tree base1, HOST_WIDE_INT offset1, HOST_WIDE_INT size1, tree base2, HOST_WIDE_INT offset2, HOST_WIDE_INT size2, HOST_WIDE_INT max_size2) { - /* For now, just handle VAR_DECL. */ - bool base1_obj_p = VAR_P (base1); - bool base2_obj_p = VAR_P (base2); + /* Offsets need to be 0. */ + if (offset1 != 0 + || offset2 != 0) + return false; + + bool base1_obj_p = SSA_VAR_P (base1); + bool base2_obj_p = SSA_VAR_P (base2); /* We need one object. */ if (base1_obj_p == base2_obj_p) @@ -2356,13 +2360,9 @@ same_addr_size_stores_p (tree base1, HOST_WIDE_INT offset1, HOST_WIDE_INT size1, if (size1 != size2) return false; - /* Offsets need to be 0. */ - if (offset1 != 0 - || offset2 != 0) - return false; /* Check that memref is a store to pointer with singleton points-to info. */ - if (!tree_int_cst_equal (TREE_OPERAND (memref, 1), integer_zero_node)) + if (!integer_zerop (TREE_OPERAND (memref, 1))) return false; tree ptr = TREE_OPERAND (memref, 0); if (TREE_CODE (ptr) != SSA_NAME) @@ -2373,10 +2373,13 @@ same_addr_size_stores_p (tree base1, HOST_WIDE_INT offset1, HOST_WIDE_INT size1, || !pt_solution_singleton_or_null_p (&pi->pt, &pt_uid)) return false; + /* If the solution has a singleton and NULL, then we can not + be sure that the two stores hit the same address. */ + if (pi->pt.null) + return false; + /* Check that ptr points relative to obj. */ - unsigned int obj_uid = (DECL_PT_UID_SET_P (obj) - ? DECL_PT_UID (obj) - : DECL_UID (obj)); + unsigned int obj_uid = DECL_PT_UID (obj); if (obj_uid != pt_uid) return false; |