[PATCH] fix size_estimation for builtin_expect

Jan Hubicka hubicka@ucw.cz
Wed Oct 2 16:12:00 GMT 2013


> > Hi,
> >
> > builtin_expect should be a NOP in size_estimation. Indeed, the call
> > stmt itself is 0 weight in size and time. But it may introduce
> > an extra relation expr which has non-zero size/time. The end result
> > is: for w/ and w/o builtin_expect, we have different size/time estimation
> > for inlining.
> >
> > This patch fixes this problem.
> >
> > An earlier discussion of this patch is
> >   https://mail.google.com/mail/u/0/?pli=1#label/gcc-paches/1415c590ad8c5315
> >
> > This new patch address Honza's comments.
> > It passes the bootstrap and regression.
> >
> > Richard: I looked at your tree-ssa.c:walk_use_def_chains() code. I think
> > that's an overkill for this simple problem. Your code is mostly dealing
> > with the recursively walk the PHI node to find the real def stmts.
> > Here the traversal is within one BB and I may need to continue on multiple
> > real assignment. Calling walk_use_def_chains probably only uses
> > the SSA_NAME_DEF_STMT() part of the code.
> >
> > Thanks,
> >
> > -Rong

This patch is OK.  Add white space after 
+          bool match = false;
+          bool done = false;

and fix
+          if (match && single_imm_use (var, &use_p, &use_stmt) &&
+              (gimple_code (use_stmt) == GIMPLE_COND))

&& should be at beggining of new line..

Thanks,
Honza



More information about the Gcc-patches mailing list