Commit ab50a215 by Martin Liska Committed by Martin Liska

Fix usage of POW2 histogram

	* value-prof.c (gimple_divmod_values_to_profile): Do not
	instrument MOD histogram if a value is not a SSA name.
	* gcc.dg/tree-prof/val-prof-9.c: New test.

From-SVN: r239305
parent dcb1e137
2016-08-09 Martin Liska <mliska@suse.cz> 2016-08-09 Martin Liska <mliska@suse.cz>
* value-prof.c (gimple_divmod_values_to_profile): Do not
instrument MOD histogram if a value is not a SSA name.
2016-08-09 Martin Liska <mliska@suse.cz>
* value-prof.c (dump_histogram_value): Swap pow2 and non-pow2 * value-prof.c (dump_histogram_value): Swap pow2 and non-pow2
values. values.
......
2016-08-09 Martin Liska <mliska@suse.cz> 2016-08-09 Martin Liska <mliska@suse.cz>
* gcc.dg/tree-prof/val-prof-9.c: New test.
2016-08-09 Martin Liska <mliska@suse.cz>
* gcc.dg/tree-prof/val-prof-8.c: New test. * gcc.dg/tree-prof/val-prof-8.c: New test.
2016-08-09 Martin Jambor <mjambor@suse.cz> 2016-08-09 Martin Jambor <mjambor@suse.cz>
......
/* { dg-options "-O0 -fdump-tree-optimized" } */
int
main (int argc, char **argv)
{
unsigned u = (argc - 1);
int counter = 0;
for (unsigned i = 0; i < 100; i++)
{
counter += u % 16;
}
return counter;
}
/* autofdo does not do value profiling so far */
/* { dg-final-use-not-autofdo { scan-tree-dump-times "__gcov_pow2_profiler" 0 "optimized" } } */
...@@ -1950,7 +1950,8 @@ gimple_divmod_values_to_profile (gimple *stmt, histogram_values *values) ...@@ -1950,7 +1950,8 @@ gimple_divmod_values_to_profile (gimple *stmt, histogram_values *values)
/* For mod, check whether it is not often a noop (or replaceable by /* For mod, check whether it is not often a noop (or replaceable by
a few subtractions). */ a few subtractions). */
if (gimple_assign_rhs_code (stmt) == TRUNC_MOD_EXPR if (gimple_assign_rhs_code (stmt) == TRUNC_MOD_EXPR
&& TYPE_UNSIGNED (type)) && TYPE_UNSIGNED (type)
&& TREE_CODE (divisor) == SSA_NAME)
{ {
tree val; tree val;
/* Check for a special case where the divisor is power of 2. */ /* Check for a special case where the divisor is power of 2. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment