From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2173 invoked by alias); 24 Mar 2010 19:02:23 -0000 Received: (qmail 711 invoked by uid 48); 24 Mar 2010 19:02:02 -0000 Date: Wed, 24 Mar 2010 19:02:00 -0000 Message-ID: <20100324190202.710.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: "hubicka 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-03/txt/msg02480.txt.bz2 ------- Comment #23 from hubicka at gcc dot gnu dot org 2010-03-24 19:02 ------- Created an attachment (id=20188) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20188&action=view) Patch in testing Hi, this is patch I am testing. I was also re-thinking the problem of redirecting BB with dead conditional to next useful postdominator (that is the "fixed" version of algorihm by shiller). I am not convinced we can pick random PHI argument here as Richard changed my original code looking for source of control dependent graph. The testcase would be something like BB1 with succesors BB2 and BB6 BB2 with succesors BB3 and BB4 BB3 and BB4 with succesors BB5 and BB6 containing PHI that is A from BB1 and B from BB3 or BB4 If we end up eliminating BB3 and BB4 and thus condition in BB3, we will redirect BB3 to BB5. The argument of PHI however must be updated to B for new edge, not A as we pick currently. I will try to create real world testcase and I think we can fix this by avoidiging the redirection. Cytron et al suggest using random edge leaving BB with dead conditional. This is wrong since it closes infinite loops. I think we can instead of that just pick random edge that is not loopback edge in DFS. That won't close loops and will result in acyclic reverse EBBS of empty blocks we easilly cleanup afterwards. Honza -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42906