https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93946
--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> --- On March 27, 2020 9:19:33 PM GMT+01:00, "sandra at gcc dot gnu.org" <gcc-bugzi...@gcc.gnu.org> wrote: >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93946 > >--- Comment #11 from sandra at gcc dot gnu.org --- >RTL before sched2 does look sane and similar to that generated for x86 >with >-m32. > >I've been trying to step through sched2. I think that where things get >interesting is the call to true_dependence at sched-deps.c:2663. > >Breakpoint 6, true_dependence (mem=0x7ffff742c9a8, mem_mode=E_VOIDmode, > > x=0x7ffff742cac8) > at /scratch/sandra/nios2-elf-fsf/src/gcc-mainline/gcc/alias.c:3056 >3056 return true_dependence_1 (mem, mem_mode, NULL_RTX, >(gdb) print debug_rtx(mem) >(mem/j:SI (reg/v/f:SI 5 r5 [orig:48 ptr ] [48]) [1 MEM[(struct aa >*)ptr_1(D)].a.u.i+0 S4 A32]) >$19 = void >(gdb) print debug_rtx(x) >(mem/j:SI (reg/v/f:SI 4 r4 [orig:47 bv ] [47]) [1 bv_3(D)->b.u.f+0 S4 >A32]) >$20 = void > >This is making it all the way to the end of true_dependence_1, into >rtx_refs_may_alias_p, and into refs_may_alias_p_1, which is returning >false, >which gets propagated back up as the result of true_dependence. IIUC, >this is >what is allowing sched2 to move the read from "x" ahead of the write to >"mem". > >Before I spend more time on this, am I on the right track here? And is >this >pointing at the problem being in refs_may_alias_p_1 rather than >somewhere along >the way e.g. in true_dependence_1? Those are two stores, right? Then true_dependence is the wrong predicate to look at it should be output_dependence instead.