aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-05-25 13:08:28 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-05-25 13:08:28 +0000
commit27312bf2148af2bea946fcec8f4c2e1231e8d63b (patch)
treef39e10cb0937194fe5afa1b80ccfc7c530de6755 /gcc/tree-vect-data-refs.c
parentb55f342bdd8bec16b727a5889c589dd85c5ca3c3 (diff)
downloadgcc-27312bf2148af2bea946fcec8f4c2e1231e8d63b.zip
gcc-27312bf2148af2bea946fcec8f4c2e1231e8d63b.tar.gz
gcc-27312bf2148af2bea946fcec8f4c2e1231e8d63b.tar.bz2
tree-ssa-alias.h (refs_may_alias_p): Add tbaa_p bool parameter, defaulted to true.
2018-05-25 Richard Biener <rguenther@suse.de> * tree-ssa-alias.h (refs_may_alias_p): Add tbaa_p bool parameter, defaulted to true. (ref_maybe_used_by_stmt_p): Likewise. (stmt_may_clobber_ref_p): Likewise. (stmt_may_clobber_ref_p_1): Likewise. * tree-ssa-alias.c (refs_may_alias_p): Add tbaa_p bool parameter and pass it along. (ref_maybe_used_by_stmt_p): Likewise. (stmt_may_clobber_ref_p): Likewise. (stmt_may_clobber_ref_p_1): Likewise. * tree-vect-data-refs.c (vect_slp_analyze_node_dependences): Use the alias oracle to disambiguate DRs with stmts DR analysis couldn't handle. (vect_analyze_data_refs): Do not give up on not analyzable DRs for BB vectorization. Remove code truncating the dataref vector. From-SVN: r260757
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r--gcc/tree-vect-data-refs.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 65b2366..331423a 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -664,6 +664,8 @@ vect_slp_analyze_node_dependences (slp_instance instance, slp_tree node,
if (access == last_access)
continue;
data_reference *dr_a = STMT_VINFO_DATA_REF (vinfo_for_stmt (access));
+ ao_ref ref;
+ bool ref_initialized_p = false;
for (gimple_stmt_iterator gsi = gsi_for_stmt (access);
gsi_stmt (gsi) != last_access; gsi_next (&gsi))
{
@@ -673,12 +675,19 @@ vect_slp_analyze_node_dependences (slp_instance instance, slp_tree node,
continue;
/* If we couldn't record a (single) data reference for this
- stmt we have to give up. */
- /* ??? Here and below if dependence analysis fails we can resort
- to the alias oracle which can handle more kinds of stmts. */
+ stmt we have to resort to the alias oracle. */
data_reference *dr_b = STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt));
if (!dr_b)
- return false;
+ {
+ /* We are moving a store or sinking a load - this means
+ we cannot use TBAA for disambiguation. */
+ if (!ref_initialized_p)
+ ao_ref_init (&ref, DR_REF (dr_a));
+ if (stmt_may_clobber_ref_p_1 (stmt, &ref, false)
+ || ref_maybe_used_by_stmt_p (stmt, &ref, false))
+ return false;
+ continue;
+ }
bool dependent = false;
/* If we run into a store of this same instance (we've just
@@ -4183,10 +4192,13 @@ vect_analyze_data_refs (vec_info *vinfo, poly_uint64 *min_vf)
"failed ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
}
-
if (is_a <bb_vec_info> (vinfo))
- break;
-
+ {
+ /* In BB vectorization the ref can still participate
+ in dependence analysis, we just can't vectorize it. */
+ STMT_VINFO_VECTORIZABLE (stmt_info) = false;
+ continue;
+ }
return false;
}
}
@@ -4379,21 +4391,9 @@ vect_analyze_data_refs (vec_info *vinfo, poly_uint64 *min_vf)
}
}
- /* If we stopped analysis at the first dataref we could not analyze
- when trying to vectorize a basic-block mark the rest of the datarefs
- as not vectorizable and truncate the vector of datarefs. That
- avoids spending useless time in analyzing their dependence. */
- if (i != datarefs.length ())
- {
- gcc_assert (is_a <bb_vec_info> (vinfo));
- for (unsigned j = i; j < datarefs.length (); ++j)
- {
- data_reference_p dr = datarefs[j];
- STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr))) = false;
- free_data_ref (dr);
- }
- datarefs.truncate (i);
- }
+ /* We used to stop processing and prune the list here. Verify we no
+ longer need to. */
+ gcc_assert (i == datarefs.length ());
return true;
}