From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2125 invoked by alias); 15 Jul 2009 08:07:23 -0000 Received: (qmail 2058 invoked by uid 48); 15 Jul 2009 08:07:10 -0000 Date: Wed, 15 Jul 2009 08:07:00 -0000 Message-ID: <20090715080710.2057.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/40730] redundant memory load In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "carrot at google dot com" 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 X-SW-Source: 2009-07/txt/msg01234.txt.bz2 ------- Comment #7 from carrot at google dot com 2009-07-15 08:07 ------- (In reply to comment #6) > Carrot, can you please try this test case with my patch > "crossjump_abstract.diff" from Bug 20070 applied? > I tried your patch. It did remove the redundant memory load. Following is the output push {lr} ldr r3, [r1] .L6: str r3, [r0] mov r2, r3 // M cmp r3, #0 bne .L5 b .L3 .L4: ldr r3, [r3, #8] b .L6 .L5: ldr r1, [r3, #4] cmp r1, #0 beq .L4 .L3: str r2, [r0, #12] @ sp needed for prologue pop {pc} In pass ifcvt it noticed the difference of two stores is the different pseudo register number and there is no conflict between the two pseudo registers, so it rename one of them to the same as another and do basic block cross jump on them earlier. Then pass iterate.c.161r.cse2 detected the redundant load and remove it. But it introduced another redundant move instruction marked as M. At the place r2 is used, r3 still contain the same result as r2, so we can also use r3 there. I think this is another problem. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40730