From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30956 invoked by alias); 4 Feb 2010 23:22:44 -0000 Received: (qmail 30922 invoked by uid 48); 4 Feb 2010 23:22:28 -0000 Date: Thu, 04 Feb 2010 23:22:00 -0000 Subject: [Bug tree-optimization/42963] New: [4,5 Regression] Redundant switch labels not cleaned up anymore X-Bugzilla-Reason: CC Message-ID: 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-02/txt/msg00328.txt.bz2 Test case is taken from bug 18046: ----------------------------------------------------- extern void foo (void); extern int i; void bar (void) { switch (i) { case 0: foo (); break; case 1: break; } switch (i) { case 0: foo (); break; case 1: break; } } ----------------------------------------------------- the .012t.cfg dump with trunk (r156492) today looks like this: bar () { int i.0; : i.0 = i; switch (i.0) , case 0: , case 1: > : foo (); : i.0 = i; switch (i.0) , case 0: , case 1: > : foo (); : return; } The dump with "gcc (Debian 4.3.4-5) 4.3.4" looks better: bar () { int i.0; # BLOCK 2 # PRED: ENTRY (fallthru) i.0 = i; switch (i.0) { case 0: goto ; default : goto ; } # SUCC: 3 4 # BLOCK 3 # PRED: 2 :; foo (); # SUCC: 4 (fallthru) # BLOCK 4 # PRED: 2 3 (fallthru) :; i.0 = i; switch (i.0) { case 0: goto ; default : goto ; } # SUCC: 5 6 # BLOCK 5 # PRED: 4 :; foo (); # SUCC: 6 (fallthru) # BLOCK 6 # PRED: 4 5 (fallthru) :; return; # SUCC: EXIT } Note how GCC 4.5 fails to clean up the "case 1" label. The label is retained all the way through the .137t.nrv dump (at -O2) and only disappears in the .139t.optimized dump. This confuses things in a couple of places and costs memory for no reason. -- Summary: [4,5 Regression] Redundant switch labels not cleaned up anymore Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: steven at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42963