From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118857 invoked by alias); 26 Jun 2015 09:55:02 -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 118280 invoked by uid 48); 26 Jun 2015 09:54:58 -0000 From: "gcc-bugzilla at enginuities dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/65371] arm loop with volatile variable Date: Fri, 26 Jun 2015 09:55: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: 5.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: gcc-bugzilla at enginuities dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: 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: 2015-06/txt/msg02593.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65371 --- Comment #4 from Stuart --- The assembly generated from Comment #1 looks good. However, the assembly generated from Comment #3 hasn't improved, it still contains the unnecessary mov instruction on line 2 (mov r2, r3). The first instruction movs the address in to r3 and the second movs r3 in to r2. The instruction at label .L2 loads data in to r3 from the address in r2, overwriting r3 and making the instruction on line 2 unnecessary... I would have expected to see: func: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. mov r2, #1073741824 ldr r1, [r2] .L2: ldr r3, [r2] subs r3, r3, r1 uxth r3, r3 cmp r3, r0 bcc .L2 bx lr