This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fix size_estimation for builtin_expect
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Rong Xu <xur at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>, Richard Biener <richard dot guenther at gmail dot com>, David Li <davidxl at google dot com>
- Date: Wed, 2 Oct 2013 18:12:16 +0200
- Subject: Re: [PATCH] fix size_estimation for builtin_expect
- Authentication-results: sourceware.org; auth=none
- References: <CAF1bQ=QB1-a6AFriiOj3dSk0=0vY+Q0UBX7Q6F6CyuiT9q-=Tg at mail dot gmail dot com> <CAF1bQ=Sz4Ak+bcMQDKZin8s-w91pPaAREu7YC1y3x7dExHwWUQ at mail dot gmail dot com>
> > 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