From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11939 invoked by alias); 16 Jul 2014 09:03:12 -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 11883 invoked by uid 48); 16 Jul 2014 09:03:08 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/61801] sched2 miscompiles syscall sequence with -g Date: Wed, 16 Jul 2014 09:03: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.8.3 X-Bugzilla-Keywords: missed-optimization, ra, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on assigned_to everconfirmed 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-07/txt/msg01058.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2014-07-16 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #8 from Richard Biener --- The following fixes it as well, in the scheduler. Index: gcc/sched-deps.c =================================================================== --- gcc/sched-deps.c (revision 212580) +++ gcc/sched-deps.c (working copy) @@ -2713,7 +2713,8 @@ sched_analyze_2 (struct deps_desc *deps, break; case PREFETCH: - if (PREFETCH_SCHEDULE_BARRIER_P (x)) + if (PREFETCH_SCHEDULE_BARRIER_P (x) + && !DEBUG_INSN_P (insn)) reg_pending_barrier = TRUE_BARRIER; /* Prefetch insn contains addresses only. So if the prefetch address has no registers, there will be no dependencies on @@ -2750,7 +2751,8 @@ sched_analyze_2 (struct deps_desc *deps, Consider for instance a volatile asm that changes the fpu rounding mode. An insn should not be moved across this even if it only uses pseudo-regs because it might give an incorrectly rounded result. */ - if (code != ASM_OPERANDS || MEM_VOLATILE_P (x)) + if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x)) + && !DEBUG_INSN_P (insn)) reg_pending_barrier = TRUE_BARRIER; /* For all ASM_OPERANDS, we must traverse the vector of input operands. we then have ;; --- Region Dependences --- b 12 bb 0 ;; insn code bb dep prio cost reservation ;; ---- ---- -- --- ---- ---- ----------- ;; 239 90 12 1 5 1 athlon-direct,athlon-agu,athlon-store : 127 123nm 216n 240 ... ;; 122 -1 12 3 0 0 nothing : 124 123nm ;; 216 90 12 1 5 3 athlon-direct,athlon-load : 127 123nm 243 so the false forward dependence of the store to the debug-insn is gone and instead a proper dependence on the load is there. Testing the fix.