From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27736 invoked by alias); 8 Oct 2011 10:23:13 -0000 Received: (qmail 27727 invoked by uid 22791); 8 Oct 2011 10:23:12 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 08 Oct 2011 10:22:58 +0000 From: "amker.cheng at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/50663] New: conditional propagation missed in cprop.c pass Date: Sat, 08 Oct 2011 10:23:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: amker.cheng at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2011-10/txt/msg00572.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50663 Bug #: 50663 Summary: conditional propagation missed in cprop.c pass Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: rtl-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: amker.cheng@gmail.com For following test case: extern int g; int main(int a, int b) { if (a == 1) { b = a; } g = b; return 0; } piece of dump file for cprop1 pass is like: (insn 8 4 9 2 (set (reg:CC 24 cc) (compare:CC (reg/v:SI 135 [ a ]) (const_int 1 [0x1]))) test.c:4 200 {*arm_cmpsi_insn} (nil)) (jump_insn 9 8 10 2 (set (pc) (if_then_else (ne (reg:CC 24 cc) (const_int 0 [0])) (label_ref 11) (pc))) test.c:4 212 {*arm_cond_branch} (expr_list:REG_DEAD (reg:CC 24 cc) (expr_list:REG_BR_PROB (const_int 6218 [0x184a]) (nil))) -> 11) (note 10 9 5 3 [bb 3] NOTE_INSN_BASIC_BLOCK) (insn 5 10 11 3 (set (reg/v:SI 136 [ b ]) (reg/v:SI 135 [ a ])) test.c:4 696 {*thumb2_movsi_insn} (expr_list:REG_DEAD (reg/v:SI 135 [ a ]) (expr_list:REG_EQUAL (const_int 1 [0x1]) (nil)))) The r135 in insn_5 should handled by conditional propagation, like: (note 10 9 5 3 [bb 3] NOTE_INSN_BASIC_BLOCK) (insn 5 10 11 3 (set (reg/v:SI 136 [ b ]) (const_int 1 [0x1])) test.c:4 709 {*thumb2_movsi_insn} (expr_list:REG_DEAD (reg/v:SI 135 [ a ]) (expr_list:REG_EQUAL (const_int 1 [0x1]) (nil)))) Seems cprop misses the conditional propagation for the branch basic block. FYI, I compiled the test case with command: ./arm-none-eabi-gcc -march=armv7-m -mthumb -O2 -S test.c -o test.S -da The gcc is comfigured for arm-none-eabi and it's on trunk.