From: Rong Xu Date: Thu, 3 Oct 2013 17:15:56 +0000 (+0000) Subject: ipa-inline-analysis.c (find_foldable_builtin_expect): Find the candidate of builtin_e... X-Git-Tag: releases/gcc-4.9.0~3722 X-Git-Url: https://gcc.gnu.org/git/?a=commitdiff_plain;h=111c3f39f58e7fd55f072243e6d8dc31987f0e45;p=gcc.git ipa-inline-analysis.c (find_foldable_builtin_expect): Find the candidate of builtin_expect such that we should fix the size/time... * ipa-inline-analysis.c (find_foldable_builtin_expect): Find the candidate of builtin_expect such that we should fix the size/time estimation. (estimate_function_body_sizes): Do the acutally size/time fix-up for builtin_expect. From-SVN: r203168 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c5ffb64ff05e..f6c57ff0b986 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-10-03 Rong Xu + + * ipa-inline-analysis.c (find_foldable_builtin_expect): Find + the candidate of builtin_expect such that we should fix the + size/time estimation. + (estimate_function_body_sizes): Do the acutally size/time fix-up + for builtin_expect. + 2013-10-03 Rong Xu * predict.c (tree_predict_by_opcode): Get the probability diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 7ca09ad0b916..304f9f5d7cc8 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -2257,6 +2257,77 @@ array_index_predicate (struct inline_summary *info, return p; } +/* For a typical usage of __builtin_expect (aconds = NULL; info->entry = NULL; @@ -2360,6 +2432,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) } } + fix_builtin_expect_stmt = find_foldable_builtin_expect (bb); + for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) { gimple stmt = gsi_stmt (bsi); @@ -2368,6 +2442,14 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) int prob; struct predicate will_be_nonconstant; + /* This relation stmt should be folded after we remove + buildin_expect call. Adjust the cost here. */ + if (stmt == fix_builtin_expect_stmt) + { + this_size--; + this_time--; + } + if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, " ");