From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27125 invoked by alias); 7 Feb 2014 16:43: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 27067 invoked by uid 48); 7 Feb 2014 16:43:13 -0000 From: "marcin.krotkiewski at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/60086] suboptimal asm generated for a loop (store/load false aliasing) Date: Fri, 07 Feb 2014 16:43: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.7.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marcin.krotkiewski at gmail dot com X-Bugzilla-Status: NEW 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/msg00736.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60086 --- Comment #8 from Marcin Krotkiewski --- (In reply to Andrey Belevantsev from comment #5) > At this point insn 461 is dead but we do not notice, and it doesn't look > easy. I think there was some suggestion in the original research for > killing dead insn copies left after renaming but I don't remember offhand. Following Alexanders suggestion, I compiled the test code with -mavx -O3 -fselective-scheduling2 -frename-registers. This seems to get rid of the dead instructions and yields the desired scheduling: .L5: vmovapd (%rbx,%rdi), %ymm0 addq $1, %rsi vmovapd (%r12,%rdi), %ymm3 vaddpd 0(%r13,%rdi), %ymm0, %ymm2 vaddpd (%r14,%rdi), %ymm3, %ymm4 vmovapd %ymm2, (%rbx,%rdi) vmovapd %ymm4, (%r12,%rdi) addq $32, %rdi cmpq %rsi, %rdx ja .L5 Alexander, I should maybe clarify that the 'good' code was prepared by hand, modifying the 'bad' asm I got from gcc 4.7. Asm generated by gcc 4.4 was the same. If that is what you were refering to. I am a bit confused now. It seems that all fine and the desired asm can be generated, so there is no real bug. But why is the original code compiled with -O3 -mavx bad then? Is -fschedule-insns not enabled at -O2?