Message ID | alpine.LSU.2.11.1402031637450.29326@zhemvz.fhfr.qr |
---|---|
State | New |
Headers | show |
On Mon, Feb 03, 2014 at 04:42:39PM +0100, Richard Biener wrote: > > This fixes PR60012 by considering TBAA for all DDRs in vectorizer > dependence analysis because the vectorizer can rely on at least > covering two scalar iterations. > > It _should_ be a regression from 4.4 but I can't make a testcase > that has two TBAA disambiguatable types and is vectorized with 4.4 > it seems ... > > Bootstrapped and tested on x86_64-unknown-linux-gnu, ok at this stage? Ok. > 2014-02-03 Richard Biener <rguenther@suse.de> > > PR tree-optimization/60012 > * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Apply > TBAA disambiguation to all DDRs. > > * gcc.dg/vect/pr60012.c: New testcase. Jakub
Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c (revision 207417) +++ gcc/tree-vect-data-refs.c (working copy) @@ -235,6 +235,18 @@ vect_analyze_data_ref_dependence (struct || (DR_IS_READ (dra) && DR_IS_READ (drb))) return false; + /* Even if we have an anti-dependence then, as the vectorized loop covers at + least two scalar iterations, there is always also a true dependence. + As the vectorizer does not re-order loads and stores we can ignore + the anti-dependence if TBAA can disambiguate both DRs similar to the + case with known negative distance anti-dependences (positive + distance anti-dependences would violate TBAA constraints). */ + if (((DR_IS_READ (dra) && DR_IS_WRITE (drb)) + || (DR_IS_WRITE (dra) && DR_IS_READ (drb))) + && !alias_sets_conflict_p (get_alias_set (DR_REF (dra)), + get_alias_set (DR_REF (drb)))) + return false; + /* Unknown data dependence. */ if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know) {