From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7274 invoked by alias); 22 Jun 2013 12:22:38 -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 7209 invoked by uid 48); 22 Jun 2013 12:22:31 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/50749] Auto-inc-dec does not find subsequent contiguous mem accesses Date: Sat, 22 Jun 2013 12:22: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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: olegendo at gcc dot gnu.org 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: 2013-06/txt/msg01198.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50749 --- Comment #14 from Oleg Endo --- Just wanted to clarify the reason why the examples in the description have '-fno-ivopts', as it caused some confusion on the mailing list: int test_0 (char* p, int c) { int r = 0; r += *p++; r += *p++; r += *p++; return r; } compiled with -m4 -O2: mov.b @(1,r4),r0 mov.b @r4,r1 add r0,r1 mov.b @(2,r4),r0 rts add r1,r0 compiled with -m4 -Os: mov.b @(1,r4),r0 mov.b @r4,r2 add r0,r2 mov.b @(2,r4),r0 add r0,r2 rts mov r2,r0 As seen above, the memory accesses are turned into reg+disp addressing, although on SH using post-inc addressing would be cheaper (as it is also reported 'sh_address_cost'). Turning off ivopts leaves the post-inc addressing and points out the original problem of this PR. I believe that the proper fix for this would be having PR 56590 fixed.