This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v5] Missed function specialization + partial devirtualization
- From: Martin Liška <mliska at suse dot cz>
- To: luoxhu <luoxhu at linux dot ibm dot com>, gcc-patches at gcc dot gnu dot org
- Cc: hubicka at ucw dot cz, segher at kernel dot crashing dot org, wschmidt at linux dot ibm dot com
- Date: Tue, 22 Oct 2019 16:07:29 +0200
- Subject: Re: [PATCH v5] Missed function specialization + partial devirtualization
- References: <20190712085102.18858-1-luoxhu@linux.ibm.com> <942697f0-8125-49f3-44f0-15b8908d3cf6@suse.cz> <42e71441-3a7e-13aa-7d57-f9880591fc28@linux.ibm.com> <35cc389f-f0c2-6c0a-7a54-30be7d9b3804@suse.cz> <995322a5-2414-e042-a9da-bf371abe40db@linux.ibm.com> <e9af3d9f-af76-fff8-26f9-3b133e4cec8e@suse.cz> <6da99579-ce5d-b515-f066-a47cc145581f@linux.ibm.com> <841c5fe8-ff2b-3bc0-82ab-55c26ea0e6ca@suse.cz> <27f369d8-d961-481f-a197-4506e4619ce6@linux.ibm.com>
On 9/27/19 9:13 AM, luoxhu wrote:
> Thanks for your time of so many round of reviews.
You're welcome. One last request would be please to make
gimple_ic_transform a void function. See attached patch.
I'll remind the patch today to Honza.
Thanks,
Martin
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 5f095d848f0..7cb99376c69 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -107,7 +107,7 @@ static bool gimple_divmod_fixed_value_transform (gimple_stmt_iterator *);
static bool gimple_mod_pow2_value_transform (gimple_stmt_iterator *);
static bool gimple_mod_subtract_transform (gimple_stmt_iterator *);
static bool gimple_stringops_transform (gimple_stmt_iterator *);
-static bool gimple_ic_transform (gimple_stmt_iterator *);
+static void gimple_ic_transform (gimple_stmt_iterator *);
/* Allocate histogram value. */
@@ -617,8 +617,7 @@ gimple_value_profile_transformations (void)
if (gimple_mod_subtract_transform (&gsi)
|| gimple_divmod_fixed_value_transform (&gsi)
|| gimple_mod_pow2_value_transform (&gsi)
- || gimple_stringops_transform (&gsi)
- || gimple_ic_transform (&gsi))
+ || gimple_stringops_transform (&gsi))
{
stmt = gsi_stmt (gsi);
changed = true;
@@ -629,6 +628,9 @@ gimple_value_profile_transformations (void)
gsi = gsi_for_stmt (stmt);
}
}
+
+ /* The function never thansforms a GIMPLE statement. */
+ gimple_ic_transform (&gsi);
}
}
@@ -1411,7 +1413,7 @@ gimple_ic (gcall *icall_stmt, struct cgraph_node *direct_call,
LTO stage for later process. Modify code of this indirect call to an if-else
structure in ipa-profile finally. */
-static bool
+static void
gimple_ic_transform (gimple_stmt_iterator *gsi)
{
gcall *stmt;
@@ -1421,17 +1423,17 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
stmt = dyn_cast <gcall *> (gsi_stmt (*gsi));
if (!stmt)
- return false;
+ return;
if (gimple_call_fndecl (stmt) != NULL_TREE)
- return false;
+ return;
if (gimple_call_internal_p (stmt))
- return false;
+ return;
histogram = gimple_histogram_value_of_type (cfun, stmt, HIST_TYPE_INDIR_CALL);
if (!histogram)
- return false;
+ return;
count = 0;
all = histogram->hvalue.counters[0];
@@ -1440,11 +1442,11 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
{
if (!get_nth_most_common_value (NULL, "indirect call", histogram, &val,
&count, &all, j))
- return false;
+ return;
/* Minimum probability. should be higher than 25%. */
if (4 * count <= all)
- return false;
+ return;
direct_call = find_func_by_profile_id ((int) val);
@@ -1459,7 +1461,7 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
"module %T=> %i (will resolve only with LTO)\n",
gimple_call_fn (stmt), (int) val);
}
- return false;
+ return;
}
if (!check_ic_target (stmt, direct_call))
@@ -1471,7 +1473,7 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
"transformation skipped because of type mismatch: %G",
gimple_call_fn (stmt), direct_call->decl, stmt);
gimple_remove_histogram_value (cfun, stmt, histogram);
- return false;
+ return;
}
if (dump_enabled_p ())
@@ -1485,8 +1487,6 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
count, all);
}
}
-
- return false;
}
/* Return true if the stringop CALL shall be profiled. SIZE_ARG be