[PATCH] Don't ignore compute_all_dependences failures in phiopt (PR tree-optimization/53163)

Richard Guenther richard.guenther@gmail.com
Wed May 2 10:19:00 GMT 2012


On Wed, May 2, 2012 at 12:04 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Wed, May 02, 2012 at 11:24:13AM +0200, Richard Guenther wrote:
>> > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
>> > ok for trunk/4.7?
>>
>> Ok.
>
> Thanks.
>
>> > BTW, tree-ssa-loop-prefetch.c seems to have the same problem, but no idea
>> > how that should be handled in there...
>>
>> I think it handles it fine by treating the chrec_dont_know DDR
>> properly?  I suppose
>> failing would be an option, too, by returning a bool from
>> determine_loop_nest_reuse
>> and adjusting its single caller.
>
> IMHO it will just segfault (I don't have a testcase though).
>
>  compute_all_dependences (datarefs, &dependences, vloops, true);
>
>  FOR_EACH_VEC_ELT (ddr_p, dependences, i, dep)
>    {
>      if (DDR_ARE_DEPENDENT (dep) == chrec_known)
>        continue;
>
>      ref = (struct mem_ref *) DDR_A (dep)->aux;
>      refb = (struct mem_ref *) DDR_B (dep)->aux;
>
>      if (DDR_ARE_DEPENDENT (dep) == chrec_dont_know
>          || DDR_NUM_DIST_VECTS (dep) == 0)
>        {
>          /* If the dependence cannot be analyzed, assume that there might
>           * be
>             a reuse.  */
>          dist = 0;
>
>          ref->independent_p = false;
>          refb->independent_p = false;
>        }
>
> If compute_all_dependences above fails (returns false), then dependences
> vector will contain just single chrec_dont_know element, but with DDR_A
> (dep) == DDR_B (dep) == NULL.  So the above will try to dereference both and
> ICE before checking chrec_dont_know (and even if it wouldn't, there is
> nothing to mark independent_p = false - supposedly everything should be
> no longer independent_p).

Hm, indeed.  Mind fixing it the way I suggested?

Thanks,
Richard.

>        Jakub



More information about the Gcc-patches mailing list