From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13172 invoked by alias); 5 Sep 2004 00:50:57 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 13163 invoked by uid 48); 5 Sep 2004 00:50:57 -0000 Date: Sun, 05 Sep 2004 00:50:00 -0000 Message-ID: <20040905005057.13162.qmail@sourceware.org> From: "roger at eyesopen dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040830052611.17234.dann@godzilla.ics.uci.edu> References: <20040830052611.17234.dann@godzilla.ics.uci.edu> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug rtl-optimization/17234] if-conversion bug on x86 X-Bugzilla-Reason: CC X-SW-Source: 2004-09/txt/msg00401.txt.bz2 List-Id: ------- Additional Comments From roger at eyesopen dot com 2004-09-05 00:50 ------- This transformation is internally known as IF-CASE-1 and is performed during the second if-conversion pass, .20.ce2. From the CFG perspective this change appears to be a win (at the point it is performed); by speculatively executing a single instruction we reduce the CFG from four basic blocks to just three. i.e. 0 0' / \ | \ 1 2 => | 2 \ / | / 3 3 Normally, this simplification reduces the of unconditional branches in the code, and allows for improved basic block reordering optimizations. Unfortunately, in this case, basic block 3 marks the end of the function, and we subsequently duplicate the function epilogue. This later duplication ends up turning both forms of the above CGF into 3 basic blocks, but the if-conversion has pessimized the code with a partially dead assignment in 0' that could have remained in 3' (in the diagram below, reflecting the final CFG). i.e. 0 0' / \ => / \ 1+3 2+3 3' 2+3 One solution may be to disable IF-CASE-1 is the join block is the last basic block in the function, contains no additional instructions, and we're expecting to duplicate the epilogue. Jan, what do you think? Is there an easy way to determine if the join block of an IF-THEN-ELSE is a candidate for basic block duplication? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17234