From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21015 invoked by alias); 4 Mar 2013 08:34:39 -0000 Received: (qmail 19369 invoked by uid 48); 4 Mar 2013 08:34:12 -0000 From: "venkataramanan.kumar at amd dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/54742] Switch elimination in FSM loop Date: Mon, 04 Mar 2013 08:34:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: venkataramanan.kumar at amd dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: 2013-03/txt/msg00196.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54742 --- Comment #6 from Venkataramanan 2013-03-04 08:34:06 UTC --- (In reply to comment #5) > int first; > void thread_backedge (void) > { > int i = 0; > > do > { > if (first ==1) > { > foo (); > first=0; > } > else > { > bla (); > first =0; > } > > } while (i++ < 100); > } Can be jump threaded if (first ==1) { foo(); } else { L1: bla() } first =0 i++ if i<=99 goto L1 else return.