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

Attachment: p1_patch
Description: Binary data

Reply via email to