From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14322 invoked by alias); 30 Jan 2010 20:32:59 -0000 Received: (qmail 14271 invoked by uid 48); 30 Jan 2010 20:32:41 -0000 Date: Sat, 30 Jan 2010 20:32:00 -0000 Message-ID: <20100130203241.14270.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/42906] [4.5 Regression] Empty loop not removed In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "steven at gcc dot gnu dot org" 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: 2010-01/txt/msg03441.txt.bz2 ------- Comment #10 from steven at gcc dot gnu dot org 2010-01-30 20:32 ------- The safe thing to do, may be to ignore self control dependence, like so: ------------------------------------------------- 8< -------------- Index: tree-ssa-dce.c =================================================================== --- tree-ssa-dce.c (revision 156352) +++ tree-ssa-dce.c (working copy) @@ -390,6 +390,11 @@ gimple stmt; basic_block cd_bb = INDEX_EDGE_PRED_BB (el, edge_number); + /* Ignore control dependence on BB itself. This can happen with loops + but since we are here, we have already made BB necessary. */ + if (cd_bb == bb) + continue; + if (TEST_BIT (last_stmt_necessary, cd_bb->index)) continue; SET_BIT (last_stmt_necessary, cd_bb->index); ------------------------------------------------- 8< -------------- Needs testing, but I can't do that right now. Honza, richi...? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42906