From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26795 invoked by alias); 4 Feb 2014 09:26:16 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26753 invoked by uid 55); 4 Feb 2014 09:26:11 -0000 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/60043] -fschedule-insns2 breaks anti-dependency Date: Tue, 04 Feb 2014 09:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg00255.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60043 --- Comment #3 from rguenther at suse dot de --- On Tue, 4 Feb 2014, abel at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60043 > > Andrey Belevantsev changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |abel at gcc dot gnu.org > > --- Comment #1 from Andrey Belevantsev --- > I don't follow the reasoning of this example and the original ML thread. The > load of *b follows the store to *a, thus the scheduler is checking for the > presence of the _true_ dependence between them: > > gcc/sched-deps.c: > 2660 if (true_dependence (XEXP (pending_mem, 0), VOIDmode, t) > 2661 && ! sched_insns_conditions_mutex_p (insn, > 2662 XEXP (pending, > 0))) > 2663 note_mem_dep (t, XEXP (pending_mem, 0), XEXP (pending, > 0), > 2664 sched_deps_info->generate_spec_deps > 2665 ? BEGIN_DATA | DEP_TRUE : DEP_TRUE); > > which does not exist because the mems have different alias sets. But you have > agreed that TBAA can be used for true dependences in the ML thread, no? What > is then required from the scheduler? Yes, TBAA can be used for true dependences - but a true dependence is read-after-write. Here we have an anti-dependence, write-after-read. When the scheduler wants to exchange two mems then it needs to use the predicate that is correct _before_ the transform, not after. Thus in the above code it seems that it does not check whether the write from pending[_mem] is before or after the read in 't' - the used predicate needs to change dependent on the order of the insns (or conservatively assume an anti-dependence and thus disable TBAA).