On Wed, May 31, 2017 at 8:55 AM, Richard Sandiford <richard.sandif...@linaro.org> wrote: > Richard Sandiford <richard.sandif...@linaro.org> writes: >> "Bin.Cheng" <amker.ch...@gmail.com> writes: >>> On Wed, May 3, 2017 at 11:07 AM, Richard Biener >>> <richard.guent...@gmail.com> wrote: >>>> On Wed, May 3, 2017 at 9:54 AM, Richard Sandiford >>>> <richard.sandif...@linaro.org> wrote: >>>>> vect_find_same_alignment_drs uses the ddr dependence distance >>>>> to tell whether two references have the same alignment. Although >>>>> that's safe with the current code, there's no particular reason >>>>> why a dependence distance of 0 should mean that the accesses start >>>>> on the same byte. E.g. a reference to a full complex value could >>>>> in principle depend on a reference to the imaginary component. >>>>> A later patch adds support for this kind of dependence. >>>>> >>>>> On the other side, checking modulo vf is pessimistic when the step >>>>> divided by the element size is a factor of 2. >>>>> >>>>> This patch instead looks for cases in which the drs have the same >>>>> base, offset and step, and for which the difference in their constant >>>>> initial values is a multiple of the alignment. >>>> >>>> I'm a bit wary about trusting operand_equal_p over dependence analysis. >>>> So, did you (can you) add an assert that the new code computes >>>> same alignment in all cases where the old one did? >> >> FWIW, the operand_equal_p for the base addresses is the same as the one >> used by the dependence analysis: >> >> /* If the references do not access the same object, we do not know >> whether they alias or not. We do not care about TBAA or alignment >> info so we can use OEP_ADDRESS_OF to avoid false negatives. >> But the accesses have to use compatible types as otherwise the >> built indices would not match. */ >> if (!operand_equal_p (DR_BASE_OBJECT (a), DR_BASE_OBJECT (b), >> OEP_ADDRESS_OF) >> || !types_compatible_p (TREE_TYPE (DR_BASE_OBJECT (a)), >> TREE_TYPE (DR_BASE_OBJECT (b)))) >> { >> DDR_ARE_DEPENDENT (res) = chrec_dont_know; >> return res; >> } >> >>> At the moment operand_equal_p method looks more powerful than >>> dependence analysis, for example, it can handle the same memory >>> reference with pointer/array_ref forms like in PR65206. However, >>> given dependence check is not expensive here, is it possible to build >>> the patch on top of it when it fails? >> >> The old check isn't valid after my later patches, because there's >> no guarantee that the accesses start on the same byte. And like >> you say, the new check is more powerful in some ways (including >> the modulo vf thing I mentioned). >> >> So I'm not sure we can do anything useful with the dependence distance >> information. Sometimes it would give false positives and sometimes >> it would give false negatives. > > Upthread you said "otherwise ok" apart from the "I'm a bit wary..." part. > Is the original patch OK given the above?
Yes. Thanks, Richard. > Thanks, > Richard