From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12379 invoked by alias); 15 Oct 2012 23:44:41 -0000 Received: (qmail 12370 invoked by uid 22791); 15 Oct 2012 23:44:39 -0000 X-SWARE-Spam-Status: No, hits=-4.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Oct 2012 23:44:31 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 3BFEC5436FD; Tue, 16 Oct 2012 01:44:28 +0200 (CEST) Date: Tue, 16 Oct 2012 00:33:00 -0000 From: Jan Hubicka To: Easwaran Raman Cc: Jan Hubicka , gcc-patches@gcc.gnu.org, Steven Bosscher , David Li Subject: Re: Propagate profile counts during switch expansion Message-ID: <20121015234428.GA10838@kam.mff.cuni.cz> References: <20121004131939.GA8582@kam.mff.cuni.cz> <20121014150907.GA15581@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg01484.txt.bz2 > On Sun, Oct 14, 2012 at 8:09 AM, Jan Hubicka wrote: > > Hi, > > > > Index: optabs.c > > =================================================================== > > --- optabs.c (revision 191879) > > +++ optabs.c (working copy) > > @@ -4249,7 +4249,7 @@ prepare_operand (enum insn_code icode, rtx x, int > > we can do the branch. */ > > > > static void > > -emit_cmp_and_jump_insn_1 (rtx test, enum machine_mode mode, rtx label) > > +emit_cmp_and_jump_insn_1 (rtx test, enum machine_mode mode, rtx label, int prob) > > { > > enum machine_mode optab_mode; > > enum mode_class mclass; > > @@ -4261,7 +4261,16 @@ static void > > > > gcc_assert (icode != CODE_FOR_nothing); > > gcc_assert (insn_operand_matches (icode, 0, test)); > > - emit_jump_insn (GEN_FCN (icode) (test, XEXP (test, 0), XEXP (test, 1), label)); > > + rtx insn = emit_insn ( > > + GEN_FCN (icode) (test, XEXP (test, 0), XEXP (test, 1), label)); > > > > I think we did not change to style of mixing declaration and code yet. So > > please put declaration ahead. > Ok. > > > > > I think you want to keep emit_jump_insn. Also do nothing when profile_status > > == PROFILE_ABSENT. > > Why should this be dependent on profile_status? The PROB passed could > also come from static prediction right. In that case profile_status is PROFILE_GUESSED. > I think this should work: > > - if (single_succ_p (b)) > + else if (single_succ_p (b)) > { > e = single_succ_edge (b); > e->probability = REG_BR_PROB_BASE; > e->count = b->count; > return; > } > - guess_outgoing_edge_probabilities (b); > + else > + { > + /* We rely on BBs with more than two successors to have sane > probabilities > + and do not guess them here. For BBs terminated by switch statements > + expanded to jump-table jump, we have done the right thing during > + expansion. For EH edges, we still guess the probabilities here. */ > + bool complex_edge = false; > + FOR_EACH_EDGE (e, ei, b->succs) > + if (e->flags & EDGE_COMPLEX) > + { > + complex_edge = true; > + break; > + } > + if (complex_edge) > + guess_outgoing_edge_probabilities (b); > + } > + OK. Honza