This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Store the REG_BR_PROB probability directly as an int


> Hello Richard,
> 
> Not directly related to your patch but...
> 
> On Sun, Sep 22, 2013 at 12:54 PM, Richard Sandiford wrote:
> > @@ -588,14 +589,17 @@ cond_exec_process_if_block (ce_if_block_
> >      goto fail;
> >  #endif
> >
> > -  true_prob_val = find_reg_note (BB_END (test_bb), REG_BR_PROB, NULL_RTX);
> > -  if (true_prob_val)
> > +  note = find_reg_note (BB_END (test_bb), REG_BR_PROB, NULL_RTX);
> > +  if (note)
> >      {
> > -      true_prob_val = XEXP (true_prob_val, 0);
> > -      false_prob_val = GEN_INT (REG_BR_PROB_BASE - INTVAL (true_prob_val));
> > +      true_prob_val = XINT (note, 0);
> > +      false_prob_val = REG_BR_PROB_BASE - true_prob_val;
> >      }
> >    else
> > -    false_prob_val = NULL_RTX;
> > +    {
> > +      true_prob_val = -1;
> > +      false_prob_val = -1;
> > +    }
> >
> >    /* If we have && or || tests, do them here.  These tests are in the adjacent
> >       blocks after the first block containing the test.  */
> 
> You can just take true_prob_val and false_prob_val from the edge
> probabilities of BRANCH_EDGE and FALLTHRU_EDGE.
> 
> Looking at REG_BR_PROB notes in places where the CFG is available is
> IMHO always a bug. Other places where this happens are at least these:
> 
> loop-doloop.c:doloop_modify()
> cfgrtl.c:force_nonfallthru_and_redirect()
> cfgrtl.c:fixup_reorder_chain()
> 
> (Long-term I'd like to see REG_BR_PROB notes become redundant, by
> extending the life of the CFG all the way to final...)

Indeed, it was always my longer term plan - it is also why REG_BR_PROB
do not track counts, only probabilities. And indeed, we should avoid using
them when CFG is around.

The patch seems like nice memory use reduction. I am always happy when
unnecesary pointers disappear ;)

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]